#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x;
  cin >> x;
  for (int i = 0; i < x; i++) {
    string y;
    cin >> y;
    int z = y.length();
    if (int(y[z - 1]) == 97) cout << "KOREAN \n";
    if (int(y[z - 1]) == 111) cout << "FILIPINO \n";
    if (int(y[z - 1]) == 117) cout << "JAPANESE \n";
  }
  return 0;
}
