#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, i;
  char b[1000];
  cin >> a;
  for (i = 0; i < a; i++) {
    cin >> b;
    int c = strlen(b);
    if (b[c - 1] == 'o' && b[c - 2] == 'p')
      cout << "FILIPINO" << endl;
    else if (b[c - 1] == 'u' && b[c - 2] == 's' && b[c - 3] == 'e' &&
             b[c - 4] == 'd')
      cout << "JAPANESE" << endl;
    else if (b[c - 1] == 'u' && b[c - 2] == 's' && b[c - 3] == 'a' &&
             b[c - 4] == 'm')
      cout << "JAPANESE" << endl;
    else if (b[c - 1] == 'a' && b[c - 2] == 'd' && b[c - 3] == 'i' &&
             b[c - 4] == 'n' && b[c - 5] == 'm')
      cout << "KOREAN" << endl;
  }
}
