public static void main ( String [ ] args ) throws IOException {
  BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;
  StringTokenizer st0 = new StringTokenizer ( br . readLine ( ) ) ;
  StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ;
  StringTokenizer st1 = new StringTokenizer ( br . readLine ( ) ) ;
  br . close ( ) ;
  int n = new Integer ( st0 . nextToken ( ) ) ;
  int m = new Integer ( st0 . nextToken ( ) ) ;
  int [ ] f = new int [ n + 1 ] ;
  int [ ] b = new int [ m + 1 ] ;
  int [ ] finverse = new int [ 100005 ] ;
  for ( int i = 0 ;
  i < m ;
  i ++ ) {
    b [ i ] = new Integer ( st1 . nextToken ( ) ) ;
  }
  Arrays . fill ( finverse , - 2 ) ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    f [ i ] = new Integer ( st . nextToken ( ) ) ;
    if ( finverse [ f [ i ] ] == - 2 ) {
      finverse [ f [ i ] ] = i + 1 ;
    }
    else {
      finverse [ f [ i ] ] = - 1 ;
    }
  }
  boolean flag = false ;
  StringBuffer sb = new StringBuffer ( ) ;
  for ( int i = 0 ;
  i < m ;
  i ++ ) {
    if ( finverse [ b [ i ] ] == - 1 ) {
      flag = true ;
    }
    else if ( finverse [ b [ i ] ] == - 2 ) {
      System . out . println ( "Impossible" ) ;
      return ;
    }
    else {
      sb . append ( finverse [ b [ i ] ] ) . append ( " " ) ;
    }
  }
  if ( flag ) {
    System . out . println ( "Ambiguity" ) ;
    return ;
  }
  else {
    System . out . println ( "Possible\n" + sb ) ;
  }
}

public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st0 = new StringTokenizer ( br . readLine ( ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; StringTokenizer st1 = new StringTokenizer ( br . readLine ( ) ) ; br . close ( ) ; int n = new Integer ( st0 . nextToken ( ) ) ; int m = new Integer ( st0 . nextToken ( ) ) ; int [ ] f = new int [ n + 1 ] ; int [ ] b = new int [ m + 1 ] ; int [ ] finverse = new int [ 100005 ] ; for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = new Integer ( st1 . nextToken ( ) ) ; } Arrays . fill ( finverse , - 2 ) ; for ( int i = 0 ; i < n ; i ++ ) { f [ i ] = new Integer ( st . nextToken ( ) ) ; if ( finverse [ f [ i ] ] == - 2 ) { finverse [ f [ i ] ] = i + 1 ; } else { finverse [ f [ i ] ] = - 1 ; } } boolean flag = false ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < m ; i ++ ) { if ( finverse [ b [ i ] ] == - 1 ) { flag = true ; } else if ( finverse [ b [ i ] ] == - 2 ) { System . out . println ( " Impossible " ) ; return ; } else { sb . append ( finverse [ b [ i ] ] ) . append ( " ▁ " ) ; } } if ( flag ) { System . out . println ( " Ambiguity " ) ; return ; } else { System . out . println ( " Possible \n " + sb ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (unary_expression operand: (decimal_integer_literal))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))) alternative: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))) right: (unary_expression operand: (decimal_integer_literal)))))))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement)) alternative: (block (expression_statement (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))))) name: (identifier) arguments: (argument_list (string_literal))))))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement)) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (string_literal) right: (identifier)))))))))