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