#include <bits/stdc++.h>
int main(void) {
  int n;
  char s[1005];
  int len;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    len = (int)strlen(s);
    if (s[len - 1] == 'o' && s[len - 2] == 'p') {
      printf("FILIPINO\n");
    } else if (s[len - 1] == 'u' && s[len - 2] == 's' && (s[len - 3] == 'e') &&
               s[len - 4] == 'd') {
      printf("JAPANESE\n");
    } else if (s[len - 1] == 'u' && s[len - 2] == 's' && (s[len - 3] == 'a') &&
               s[len - 4] == 'm') {
      printf("JAPANESE\n");
    } else if (s[len - 1] == 'a' && s[len - 2] == 'd' && s[len - 3] == 'i' &&
               s[len - 4] == 'n' && s[len - 5] == 'm') {
      printf("KOREAN\n");
    }
  }
}
