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