#include <bits/stdc++.h>
std::string getlast(std::string str, int value) {
  return str.substr(str.size() - value, value);
}
int main() {
  int tcase;
  scanf("%d", &tcase);
  std::string str;
  while (tcase--) {
    std::cin >> str;
    int len = str.size();
    if (len >= 2) {
      if (getlast(str, 2) == "po") {
        std::cout << "FILIPINO"
                  << "\n";
        continue;
      }
    }
    if (len >= 4) {
      if (getlast(str, 4) == "desu" || getlast(str, 4) == "masu") {
        std::cout << "JAPANESE"
                  << "\n";
        continue;
      }
    }
    if (len >= 5) {
      if (getlast(str, 5) == "mnida") {
        std::cout << "KOREAN"
                  << "\n";
        continue;
      }
    }
  }
  return 0;
}
