public static void main ( String [ ] args ) throws Exception {
  BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ;
  int testCases = Integer . parseInt ( in . readLine ( ) ) ;
  for ( int i = 0 ;
  i < testCases ;
  i ++ ) {
    int windowsCount = Integer . parseInt ( in . readLine ( ) ) ;
    for ( int k = 0 ;
    k < windowsCount ;
    k ++ ) {
      for ( int l = 0 ;
      l < windowsCount ;
      l ++ ) {
        for ( int m = 0 ;
        m < windowsCount ;
        m ++ ) {
          if ( k * 3 + l * 5 + m * 7 == windowsCount ) {
            System . out . println ( k + " " + l + " " + m ) ;
            k = windowsCount ;
            l = windowsCount ;
            m = windowsCount ;
          }
          else if ( k == windowsCount - 1 && m == windowsCount - 1 && l == windowsCount - 1 && ! ( k * 3 + l * 5 + m * 7 == windowsCount ) ) {
            System . out . println ( "-1" ) ;
          }
        }
      }
    }
  }
}

public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int testCases = Integer . parseInt ( in . readLine ( ) ) ; for ( int i = 0 ; i < testCases ; i ++ ) { int windowsCount = Integer . parseInt ( in . readLine ( ) ) ; for ( int k = 0 ; k < windowsCount ; k ++ ) { for ( int l = 0 ; l < windowsCount ; l ++ ) { for ( int m = 0 ; m < windowsCount ; m ++ ) { if ( k * 3 + l * 5 + m * 7 == windowsCount ) { System . out . println ( k + " ▁ " + l + " ▁ " + m ) ; k = windowsCount ; l = windowsCount ; m = windowsCount ; } else if ( k == windowsCount - 1 && m == windowsCount - 1 && l == windowsCount - 1 && ! ( k * 3 + l * 5 + m * 7 == windowsCount ) ) { System . out . println ( " - 1" ) ; } } } } } }
(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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (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 (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 (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: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (string_literal)) right: (identifier)) right: (string_literal)) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (unary_expression operand: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))))))))))))))))