#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, z;
  string s;
  int len, i, j;
  string ans;
  cin >> t;
  string temp1, temp2, temp3;
  for (z = 0; z < t; z++) {
    cin >> s;
    len = s.size();
    temp1 = s.substr(len - 2, 2);
    if (len >= 4) temp2 = s.substr(len - 4, 4);
    if (len >= 5) temp3 = s.substr(len - 5, 5);
    if (temp1 == "po")
      ans = "FILIPINO";
    else if (temp2 == "desu" || temp2 == "masu")
      ans = "JAPANESE";
    else if (temp3 == "mnida")
      ans = "KOREAN";
    cout << ans << endl;
  }
}
