#include <bits/stdc++.h>
using namespace std;
long long dx[] = {-1, 1, 0, 0};
long long dy[] = {0, 0, -1, 1};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long n = s.size();
    if (s.substr(n - 2, n) == "po")
      cout << "FILIPINO"
           << "\n";
    else if (n >= 4 and
             (s.substr(n - 4, n) == "desu" or s.substr(n - 4, n) == "masu"))
      cout << "JAPANESE"
           << "\n";
    else if (n >= 5 and s.substr(n - 5, n) == "mnida")
      cout << "KOREAN"
           << "\n";
  }
}
