#include <bits/stdc++.h>
int main() {
  int test;
  scanf("%d", &test);
  while (test--) {
    char s[1100];
    scanf("%s", s);
    int n = strlen(s);
    if (s[n - 2] == 'p' && s[n - 1] == 'o')
      printf("FILIPINO\n");
    else if (s[n - 2] == 's' && s[n - 1] == 'u')
      printf("JAPANESE\n");
    else
      printf("KOREAN\n");
  }
  return 0;
}
