#include <bits/stdc++.h>
using namespace std;
int tc;
int main(void) {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  cin >> tc;
  while (tc--) {
    string s;
    cin >> s;
    long long int n = s.size();
    if (s[n - 1] == 'o' && s[n - 2] == 'p')
      cout << "FILIPINO" << endl;
    else if (s[n - 1] == 'a' && s[n - 2] == 'd' && s[n - 3] == 'i' &&
             s[n - 4] == 'n' && s[n - 5] == 'm')
      cout << "KOREAN" << endl;
    else
      cout << "JAPANESE" << endl;
  }
}
