#include <bits/stdc++.h>
int t;
char a[1500];
int main() {
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    scanf("%s", a);
    int l = strlen(a) - 1;
    if (a[l] == 'o')
      printf("FILIPINO\n");
    else if (a[l] == 'u')
      printf("JAPANESE\n");
    else if (a[l] == 'a')
      printf("KOREAN\n");
  }
}
