#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
string str;
cin >> str;
int len = str.size();
if(str.substr(len - 2) == "po")
cout << "FILIPINO" << endl;
else if(str.substr(len - 4) == "desu" || str.substr(len - 4) == "masu")
cout << "JAPANESE" << endl;
else if(str.substr(len - 5) == "mnida")
cout << "KOREAN" << endl;
}
return 0;
}
字符串&子串
str.substr( )