#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  string str;
  scanf("%d", &t);
  while (t--) {
    cin >> str;
    if (str[str.size() - 1] == 'o') printf("FILIPINO\n");
    if (str[str.size() - 1] == 'u') printf("JAPANESE\n");
    if (str[str.size() - 1] == 'a') printf("KOREAN\n");
  }
  return 0;
}
