// Arup Guha
// 10/6/05
// Solution to COP 3530 Recitation #5 Problem B: Tiling.
// Edited to solve 2006 BHCSIU Mock Contest #2 Problem Tile
// on 7/20/06

import java.util.*;
import java.io.*;

public class tile {

  public static void main(String[] args) throws IOException {

    Scanner fin = new Scanner(new File("tile.in"));

    int numcases = fin.nextInt();

    // Process each input case.
    for (int i=0; i<numcases; i++) {
    
      int n = fin.nextInt();
      print(n);
      System.out.println();
    }
	fin.close();
  }

  // Wrapper function for the recursive function that does the printing.
  public static void print(int n) {

    // We start the buffer with nothing, needing need the rest of the
    // values to sum to n.
    printAll("", n);
  }

  // The buffer stores the tiles that are already set, and n represents
  // the length of the remaining tile to separate out. This method will
  // print out all of the orderings of the tile that start with the 
  // buffer and then add up to length n after that.
  public static void printAll(String buffer, int n) {


    // We can only add a tile of length 1 to the buffer.
    if (n == 1) {
      System.out.println(buffer+"1");
      return;
    }

    // There are two ways to tile the last 2 squares, either one tile of
    // length 2 or two tiles of length 1.
    if (n == 2) {
      System.out.println(buffer+"2");
      System.out.println(buffer+"1,1");
      return;
    }

    // Otherwise, we add a tile of size 2 to the buffer, and then 
    // recursively tile the remaining length of n-2, OR, we can add
    // a tile of size 1 to the buffer, and then recursively tile the
    // remaining length of n-1.
    printAll(buffer+"2,", n-2);
    printAll(buffer+"1,", n-1);
    
  }

}
