#include <bits/stdc++.h>
using namespace std;
void cinl(long long int &number) {
  bool negative = false;
  register int c;
  number = 0;
  c = getchar();
  if (c == '-') {
    negative = true;
    c = getchar();
  }
  for (; (c > 47 && c < 58); c = getchar()) number = number * 10 + c - 48;
  if (negative) number *= -1;
}
char s[1005], ss[10];
int main() {
  int t = 0, i = 0, l = 0;
  cin >> t;
  while (t--) {
    cin >> s;
    l = strlen(s);
    if (s[l - 1] == 'o')
      cout << "FILIPINO\n";
    else if (s[l - 1] == 'u')
      cout << "JAPANESE\n";
    else
      cout << "KOREAN\n";
  }
  return 0;
}
