#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    if (s.substr(0, 2) == "op") {
      cout << "FILIPINO\n";
    } else if (s.substr(0, 4) == "used" || s.substr(0, 4) == "usam") {
      cout << "JAPANESE\n";
    } else if (s.substr(0, 5) == "adinm") {
      cout << "KOREAN\n";
    }
  }
  return 0;
}
