#include <bits/stdc++.h>
using namespace std;
int compare(pair<long long, pair<long long, long long>> A,
            pair<long long, pair<long long, long long>> B) {
  if (A.first != B.first)
    return A.first < B.first;
  else {
    if (A.second.first && A.second.second)
      return A.second.first > B.second.first;
    else if (B.second.first && B.second.second)
      return B.second.first < A.second.first;
    else
      return B.second.first < A.second.first;
  }
}
long long findOdd(long long n) {
  long long ans = 0;
  for (long long i = 3; i <= sqrt(n); i += 2) {
    if (n % i == 0 && n / i != 2) ans = max(ans, i);
    if (n / i == 0 && (n / i) % 2 == 1 && (n / (n / i)) != 2) ans = max(ans, i);
  }
  return ans;
}
int main() {
  long long t, n, a, b, c, d, k, m, x, y;
  string s, s1, s2;
  char ch;
  cin >> t;
  while (t--) {
    cin >> s;
    int len = s.length();
    if (len >= 2 && s[len - 2] == 'p' && s[len - 1] == 'o')
      cout << "FILIPINO" << endl;
    else if (len >= 4 && s.substr(len - 4) == "desu" ||
             s.substr(len - 4) == "masu")
      cout << "JAPANESE" << endl;
    else
      cout << "KOREAN" << endl;
  }
}
