#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
using namespace std;
inline long long in() {
  long long x;
  scanf("%lld", &x);
  return x;
}
void solve() {
  string s;
  cin >> s;
  long long n = s.size();
  if (s[n - 1] == 'o' and s[n - 2] == 'p') {
    puts("FILIPINO");
    return;
  }
  string b = "";
  for (long long i = n - 4; i < n; i++) b += s[i];
  if (b == "masu" or b == "desu") {
    puts("JAPANESE");
    return;
  }
  b = "";
  for (long long i = n - 5; i < n; i++) b += s[i];
  if (b == "mnida") {
    puts("KOREAN");
  }
}
int32_t main() {
  long long t = in();
  while (t--) solve();
}
