#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  char s[10000];
  for (int i = 0; i < a; i++) {
    cin >> s;
    int str = strlen(s);
    if (s[str - 1] == 'o' || s[str - 1] == 'O')
      cout << "FILIPINO\n";
    else if (s[str - 1] == 'u' || s[str - 1] == 'U')
      cout << "JAPANESE\n";
    else {
      cout << "KOREAN\n";
    }
  }
  return 0;
}
