public static void main ( String [ ] args ) {
  Scanner sc = new Scanner ( System . in ) ;
  int q = sc . nextInt ( ) ;
  while ( q -- > 0 ) {
    String s = sc . next ( ) ;
    int f = 0 , j = 0 , k = 0 ;
    int i = s . length ( ) - 1 ;
    char c = s . charAt ( i ) ;
    if ( c == 'o' && s . charAt ( i - 1 ) == 'p' ) System . out . println ( "FILIPINO" ) ;
    if ( c == 'u' && s . charAt ( i - 1 ) == 's' && s . charAt ( i - 2 ) == 'e' && s . charAt ( i - 3 ) == 'd' ) System . out . println ( "JAPANESE" ) ;
    if ( c == 'u' && s . charAt ( i - 1 ) == 's' && s . charAt ( i - 2 ) == 'a' && s . charAt ( i - 3 ) == 'm' ) System . out . println ( "JAPANESE" ) ;
    if ( c == 'a' && s . charAt ( i - 1 ) == 'd' && s . charAt ( i - 2 ) == 'i' && s . charAt ( i - 3 ) == 'n' && s . charAt ( i - 4 ) == 'm' ) System . out . println ( "KOREAN" ) ;
  }
}

public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int q = sc . nextInt ( ) ; while ( q -- > 0 ) { String s = sc . next ( ) ; int f = 0 , j = 0 , k = 0 ; int i = s . length ( ) - 1 ; char c = s . charAt ( i ) ; if ( c == ' o ' && s . charAt ( i - 1 ) == ' p ' ) System . out . println ( " FILIPINO " ) ; if ( c == ' u ' && s . charAt ( i - 1 ) == ' s ' && s . charAt ( i - 2 ) == ' e ' && s . charAt ( i - 3 ) == ' d ' ) System . out . println ( " JAPANESE " ) ; if ( c == ' u ' && s . charAt ( i - 1 ) == ' s ' && s . charAt ( i - 2 ) == ' a ' && s . charAt ( i - 3 ) == ' m ' ) System . out . println ( " JAPANESE " ) ; if ( c == ' a ' && s . charAt ( i - 1 ) == ' d ' && s . charAt ( i - 2 ) == ' i ' && s . charAt ( i - 3 ) == ' n ' && s . charAt ( i - 4 ) == ' m ' ) System . out . println ( " KOREAN " ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (while_statement condition: (parenthesized_expression (binary_expression left: (update_expression (identifier)) right: (decimal_integer_literal))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (character_literal)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))))))))