#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  char efa[2000];
  for (int i = 0; i < n; i++) {
    cin >> efa;
    int l = strlen(efa);
    if (efa[l - 1] == 'o')
      printf("FILIPINO\n");
    else if (efa[l - 1] == 'u')
      printf("JAPANESE\n");
    else if (efa[l - 1] == 'a')
      printf("KOREAN\n");
  }
}
