#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    string s;
    cin >> s;
    int n = s.length();
    if (s.substr((n - 2), 2) == "po")
      cout << "FILIPINO" << endl;
    else if (s.substr((n - 4), 4) == "desu" || s.substr((n - 4), 4) == "masu")
      cout << "JAPANESE" << endl;
    else if (s.substr((n - 5), 5) == "mnida")
      cout << "KOREAN" << endl;
  }
}
