#include <bits/stdc++.h>
using namespace std;
int q = 1;
void solve() {
  string s;
  cin >> s;
  int n = s.size();
  string t = "";
  t += s[n - 2];
  t += s[n - 1];
  if (t == "po")
    cout << "FILIPINO" << endl;
  else if (t == "su")
    cout << "JAPANESE" << endl;
  else
    cout << "KOREAN" << endl;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin >> q;
  while (q--) {
    solve();
  }
}
