#include <bits/stdc++.h>
using namespace std;
const int AS = 1024576;
char rr[AS], *csy1, *csy2;
template <class T>
inline int RI(T &t) {
  int u = 0;
  char c = (csy1 == csy2 &&
                    (csy2 = (csy1 = rr) + fread(rr, 1, AS, stdin), csy1 == csy2)
                ? EOF
                : *csy1++);
  for (t = 0; c < 48 || c > 57;
       c = (csy1 == csy2 &&
                    (csy2 = (csy1 = rr) + fread(rr, 1, AS, stdin), csy1 == csy2)
                ? EOF
                : *csy1++)) {
    if (c == EOF) return 0;
    u = c == '-' ? 1 : 0;
  }
  for (; c > 47 && c < 58;
       c = (csy1 == csy2 &&
                    (csy2 = (csy1 = rr) + fread(rr, 1, AS, stdin), csy1 == csy2)
                ? EOF
                : *csy1++))
    t = (t << 1) + (t << 3) + c - 48;
  t = u ? -t : t;
  return 1;
}
inline int RS(char *s, int &len, bool space = 0) {
  len = 0;
  char c = (csy1 == csy2 &&
                    (csy2 = (csy1 = rr) + fread(rr, 1, AS, stdin), csy1 == csy2)
                ? EOF
                : *csy1++);
  for (; c < 32 || c == 32 && !space;
       c = (csy1 == csy2 &&
                    (csy2 = (csy1 = rr) + fread(rr, 1, AS, stdin), csy1 == csy2)
                ? EOF
                : *csy1++)) {
    if (c == EOF) {
      *s = 0;
      return 0;
    }
  }
  for (; c > 32 || c == 32 && space;
       c = (csy1 == csy2 &&
                    (csy2 = (csy1 = rr) + fread(rr, 1, AS, stdin), csy1 == csy2)
                ? EOF
                : *csy1++)) {
    *s++ = c;
    len++;
  }
  *s = 0;
  return 1;
}
int n;
char name[10000];
void solve() {
  if (name[n - 1] == 'o') {
    printf("FILIPINO\n");
  } else if (name[n - 1] == 'u') {
    printf("JAPANESE\n");
  } else {
    printf("KOREAN\n");
  }
}
int main() {
  int T;
  RI(T);
  while (T--) {
    RS(name, n);
    solve();
  }
  return 0;
}
