#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, s = "";
  int b;
  cin >> b;
  for (int i = -1; i < b; i++) {
    getline(cin, a);
    int len = a.length();
    if (len >= 2 and a.substr(len - 2, 2) == "po") {
      s += "FILIPINO";
      s += '\n';
    } else if (len >= 4 and a.substr(len - 4, 4) == "masu" or
               len >= 4 and a.substr(len - 4, 4) == "desu") {
      s += "JAPANESE";
      s += '\n';
    } else if (len >= 5 and a.substr(len - 5, 5) == "mnida") {
      s += "KOREAN";
      s += '\n';
    }
  }
  cout << s;
}
