- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.io.PrintWriter;
- import java.math.*;
- import java.util.*;
- import java.io.*;
- public class C implements Runnable
- {
- private void solve() throws IOException
- {
- String str = reader.readLine();
- boolean male = false;
- boolean female = false;
- String[] ans = str.split(" ");
- if(ans[0].endsWith("lios") || ans[0].endsWith("etr"))
- {
- male = true;
- }
- if(ans[0].endsWith("liala") || ans[0].endsWith("etra"))
- {
- female = true;
- }
- if((male == false && female == false) || (male && female))
- {
- System.out.println("NO");
- return;
- }
-
- if(ans.length == 1)
- {
- System.out.println("YES");
- return;
- }
-
- boolean adjective = false;
- boolean noun = false;
- boolean verbs = false;
- int cnt = 0;
- if(male == true)
- {
- for(int i = 0; i < ans.length; i++)
- {
- if(ans[i].endsWith("lios") && noun == false)
- {
- adjective = true;
- }
- else if(ans[i].endsWith("etr") && cnt == 0)
- {
- noun = true;
- cnt++;
- }
- else if(ans[i].endsWith("initis") && noun && cnt == 1)
- {
- verbs = true;
- }
- else
- {
- System.out.println("NO");
- return;
- }
- }
- if(cnt == 1)
- System.out.println("YES");
- else
- System.out.println("NO");
- }
- else if(female == true)
- {
- for(int i = 0; i < ans.length; i++)
- {
- if(ans[i].endsWith("liala") && noun == false)
- {
- adjective = true;
- }
- else if(ans[i].endsWith("etra") && cnt == 0)
- {
- noun = true;
- cnt++;
- }
- else if(ans[i].endsWith("inites") && noun && cnt == 1)
- {
- verbs = true;
- }
- else
- {
- System.out.println("NO");
- return;
- }
- }
- if(cnt == 1)
- System.out.println("YES");
- else
- System.out.println("NO");
- }
- }
-
- public static void main(String[] args)
- {
- new C().run();
- }
- BufferedReader reader;
- StringTokenizer tokenizer;
- PrintWriter writer;
- public void run()
- {
- try
- {
- reader = new BufferedReader(new InputStreamReader(System.in));
- tokenizer = null;
- writer = new PrintWriter(System.out);
- solve();
- reader.close();
- writer.close();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(1);
- }
- }
- int nextInt() throws IOException
- {
- return Integer.parseInt(nextToken());
- }
- long nextLong() throws IOException
- {
- return Long.parseLong(nextToken());
- }
- double nextDouble() throws IOException
- {
- return Double.parseDouble(nextToken());
- }
- String nextToken() throws IOException
- {
- while (tokenizer == null || !tokenizer.hasMoreTokens())
- {
- tokenizer = new StringTokenizer(reader.readLine());
- }
- return tokenizer.nextToken();
- }
- }
=>
if(ans[0].endsWith("lios") || ans[0].endsWith("etr") || ans[0].endsWith("initis"))
and for female too