#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    string word = "";
    for (auto x : s) {
      if (x == '_') {
        word = "";
      } else {
        word = word + x;
      }
    }
    if (word.substr(word.length() - 2) == "po")
      cout << "FILIPINO\n";
    else if (word.substr(word.length() - 4) == "desu" ||
             word.substr(word.length() - 4) == "masu")
      cout << "JAPANESE\n";
    else if (word.substr(word.length() - 5) == "mnida")
      cout << "KOREAN\n";
  }
  return 0;
}
