#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    char a[2000];
    cin >> a;
    int c = 0;
    int l = strlen(a);
    for (int j = l - 1;; j--) {
      c++;
      if (c == 2) {
        if (a[l - 1] == 'o' && a[l - 2] == 'p') {
          cout << "FILIPINO" << endl;
          break;
        }
      }
      if (c == 4) {
        if (a[l - 1] == 'u' && a[l - 2] == 's' && a[l - 3] == 'e' &&
            a[l - 4] == 'd') {
          cout << "JAPANESE" << endl;
          break;
        } else if (a[l - 1] == 'u' && a[l - 2] == 's' && a[l - 3] == 'a' &&
                   a[l - 4] == 'm') {
          cout << "JAPANESE" << endl;
          break;
        }
      }
      if (c == 5) {
        if (a[l - 1] == 'a' && a[l - 2] == 'd' && a[l - 3] == 'i' &&
            a[l - 4] == 'n' && a[l - 5] == 'm') {
          cout << "KOREAN" << endl;
          break;
        }
      }
    }
  }
  return 0;
}
