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