#include <bits/stdc++.h>
using namespace std;
string t[100];
int n, p;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  for (int i = 0; i < n; i++) {
    p = t[i].length();
    if (t[i].substr(p - 2, p) == "po") {
      cout << "FILIPINO" << endl;
    } else if (t[i].substr(p - 4, p) == "desu" ||
               t[i].substr(p - 4, p) == "masu") {
      cout << "JAPANESE" << endl;
    } else {
      cout << "KOREAN" << endl;
    }
  }
}
