#include <bits/stdc++.h>
int main() {
  int t;
  char s[1000];
  char f[] = {"po"};
  char j1[] = {"desu"};
  char j2[] = {"masu"};
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%s", s);
    n = strlen(s);
    if (strncmp(s + n - 2, f, 2) == 0)
      printf("FILIPINO\n");
    else if (strncmp(s + n - 4, j1, 4) == 0 || strncmp(s + n - 4, j2, 4) == 0)
      printf("JAPANESE\n");
    else
      printf("KOREAN\n");
  }
  return 0;
}
