#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, l;
  string s;
  cin >> n;
  for (i = 0; i < n; i++) {
    l = 0;
    cin >> s;
    l = (int)s.size();
    if (s[l - 2] == 'p' && s[l - 1] == 'o')
      cout << "FILIPINO\n";
    else if ((s[l - 4] == 'd' && s[l - 3] == 'e' && s[l - 2] == 's' &&
              s[l - 1] == 'u') ||
             (s[l - 4] == 'm' && s[l - 3] == 'a' && s[l - 2] == 's' &&
              s[l - 1] == 'u'))
      cout << "JAPANESE\n";
    else
      cout << "KOREAN\n";
  }
  return 0;
}
