#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int n = s.size();
    string suf = "";
    suf.push_back(s[n - 2]);
    suf.push_back(s[n - 1]);
    if (suf == "po") cout << "FILIPINO\n";
    if (suf == "su") cout << "JAPANESE\n";
    if (suf == "da") cout << "KOREAN\n";
  }
  return 0;
}
