#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc, o;
  scanf("%d", &tc);
  for (o = 1; o <= tc; o++) {
    long long n, m, a, b, c, e, f, g, p, q, r, fr, sc, tr, sz, tz, sz1, sz2, i,
        j, k, mx = -9, mn = 999999999999;
    string str, ttr, ntr;
    long long x = 0, y = 0, cnt = 0, res = 0, ttl = 0, ans = 0, sum = 0;
    long long flg = 0, flag = 1, na = 0, as = 1;
    vector<long long> u, v, w;
    vector<pair<long long, long long> > vct, tct;
    vector<string> vst;
    set<long long> st, nt, tt;
    map<long long, long long> mp, nq, qr, mp1, mp2;
    scanf("%lld", &n);
    cin >> str;
    sz = str.size();
    if (str[sz - 1] == 'o' && str[sz - 2] == 'p') {
      printf("FILIPINO\n");
    }
    if (str[sz - 1] == 'u' && str[sz - 2] == 's' && str[sz - 3] == 'e' &&
        str[sz - 4] == 'd') {
      printf("JAPANESE\n");
    }
    if (str[sz - 1] == 'u' && str[sz - 2] == 's' && str[sz - 3] == 'a' &&
        str[sz - 4] == 'm') {
      printf("JAPANESE\n");
    }
    if (str[sz - 1] == 'a' && str[sz - 2] == 'd' && str[sz - 3] == 'i' &&
        str[sz - 4] == 'n' && str[sz - 5] == 'm') {
      printf("KOREAN\n");
    }
  }
  return 0;
}
