#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, i, count = 0, count1 = 0, count2 = 0;
    string s;
    cin >> s;
    n = s.size();
    for (i = n; i > 0; i--) {
      if (s[i] == 'o') {
        cout << "FILIPINO" << endl;
        break;
      } else if (s[i] == 'u') {
        cout << "JAPANESE" << endl;
        break;
      } else if (s[i] == 'a') {
        cout << "KOREAN" << endl;
        break;
      }
    }
  }
  return 0;
}
