#include <bits/stdc++.h>
using namespace std;
long long modular(long long a, long long b, long long c) {
  if (b == 0) {
    return 1;
  }
  if (b % 2 == 0) {
    return modular(((a * a) % c), b / 2, c);
  } else {
    return ((a % c) * (modular(((a * a) % c), b / 2, c) % c)) % c;
  }
}
signed 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.length();
    if (s[n - 2] == 'p' && s[n - 1] == 'o') {
      cout << "FILIPINO"
           << "\n";
      continue;
    }
    if (s[n - 4] == 'd' && s[n - 3] == 'e' && s[n - 2] == 's' &&
        s[n - 1] == 'u') {
      cout << "JAPANESE"
           << "\n";
      continue;
    }
    if (s[n - 4] == 'm' && s[n - 3] == 'a' && s[n - 2] == 's' &&
        s[n - 1] == 'u') {
      cout << "JAPANESE"
           << "\n";
      continue;
    }
    if (s[n - 5] == 'm' && s[n - 4] == 'n' && s[n - 3] == 'i' &&
        s[n - 2] == 'd' && s[n - 1] == 'a') {
      cout << "KOREAN"
           << "\n";
      continue;
    }
  }
  return 0;
}
