#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return a % b ? gcd(b, a % b) : b; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int prime(long long n) {
  if (n < 2) return 0;
  if (n == 2 || n == 3) return 1;
  if (n % 6 != 1 && n % 6 != 5) return 0;
  for (long long i = 5; i <= sqrt(n); i += 6) {
    if (n % i == 0 || n % (i + 2) == 0) return 0;
  }
  return 1;
}
long long power(long long a, long long b, long long p) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % p;
    a = a * a % p;
    b >>= 1;
  }
  return ans;
}
int t;
string s;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> t;
  while (t--) {
    s.clear();
    cin >> s;
    if (s[s.size() - 1] == 'o') cout << "FILIPINO" << endl;
    if (s[s.size() - 1] == 'u') cout << "JAPANESE" << endl;
    if (s[s.size() - 1] == 'a') cout << "KOREAN" << endl;
  }
  return 0;
}
