[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
create integers flag, gender, ok, t and cnt
cal is a new array of integers with size 10005
declare new string variable s
create an arrays of strings x with 6 elements = "lios", "liala", "etr", "etra", "initis", "inites", and y wth 10005 elements
function cmp with string arguments a and b that returns integer
    define integer variables len1 = length of a, and len2 = length of b
    in a for loop, change i from 0 to len2 exclusive
        if a[len1 - len2 + i] != b[i], return 0
    return 1
end of the block
function over with string argument s
    print s
    terminate the process
end of the block
define the main function
    create new integer called cnt with value 0
    loop, reading s from the input
        increment cnt by one
        change the value of y[cnt] to s
        change flag to 0
        in a for loop, change i from 0 to 6 exclusive
            if cmp(y[cnt], x[i]) returned true
                change flag to 1
                change the value of cal[cnt] to i
            end of the block
        if flag = 0, call over("NO")
        if character from the input is equal to '\n', stop the loop
    end of the block
    if cnt = 1, call over("YES")
    start for loop from i = 1 to cnt exclusive
        if cal[i] % 2 != cal[i + 1] % 2 || cal[i] > cal[i + 1], call over("NO")
    change flag to 0
    for integer i = 1 to cnt inclusive incrementing i
        if cal[i] / 2 = 1, increment flag by one
    if flag != 1, call over("NO")
    call over("YES")
    return to indicate successful execution
end of the block

[CODE]:

int flag, gender, ok, t, cnt;
int cal[10005];
string s;
string x[6] = {"lios", "liala", "etr", "etra", "initis", "inites"}, y[10005];
int cmp(string a, string b) {
    int len1 = a.size(), len2 = b.size();
    for (int i = 0; i < len2; i++)
        if (a[len1 - len2 + i] != b[i]) return 0;
    return 1;
}
void over(string s) {
    cout << s << endl;
    exit(0);
}
int main() {
    int cnt = 0;
    while (cin >> s) {
        cnt++;
        y[cnt] = s;
        flag = 0;
        for (int i = 0; i < 6; i++)
            if (cmp(y[cnt], x[i])) {
                flag = 1;
                cal[cnt] = i;
            }
        if (flag == 0) over("NO");
        if (cin.get() == '\n') break;
    }
    if (cnt == 1) over("YES");
    for (int i = 1; i < cnt; i++)
        if (cal[i] % 2 != cal[i + 1] % 2 || cal[i] > cal[i + 1]) over("NO");
    flag = 0;
    for (int i = 1; i <= cnt; i++)
        if (cal[i] / 2 == 1) flag++;
    if (flag != 1) over("NO");
    over("YES");
    return 0;
}