/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Map;
import java.util.TreeMap;
import java.util.Arrays;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
sc.nextLine();
String []frases=new String[n];
ArrayList<String[]> palabras = new ArrayList<>();
Map<String[],Integer>palabraClave =new TreeMap<>();
for (int i=0;i< n ;i++ ) {
System.out.println("INGRESA FRASE");
frases[i]=sc.nextLine();
}
for (int i=0;i<frases.length;i++ ) {
palabras.add(frases[i].split(" "));
}
for (String[]palabra:palabras) {
System.out.println(Arrays.toString(palabra));
}
for (int i=0;i<palabras.size();i++ ) {
for (int j=0;j<palabras.get(i).length;j++ ) {
System.out.println(palabras.get(i)[j]);
}
}
}}