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