#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    if (s.length() >= 2) {
      string p = "po";
      string s1 = s.substr(s.length() - 2, 2);
      if (s1 == p) {
        cout << "FILIPINO" << endl;
      }
    }
    if (s.length() >= 4) {
      string p = "desu";
      string q = "masu";
      string s1 = s.substr(s.length() - 4, 4);
      if (s1 == p || s1 == q) {
        cout << "JAPANESE" << endl;
      }
    }
    if (s.length() >= 5) {
      string p = "mnida";
      string s1 = s.substr(s.length() - 5, 5);
      if (s1 == p) {
        cout << "KOREAN" << endl;
      }
    }
  }
}
