/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		double a[][] = new double[n][];
		double b[] = new double[n];
		for (int i = 0 ; i != n ; i++) {
			String[] tok = br.readLine().split(",");
			a[i] = new double[tok.length-1];
			for (int j = 0 ; j != a[i].length ; j++) {
				a[i][j] = Double.parseDouble(tok[j]);
			}
			b[i] = Double.parseDouble(tok[tok.length-1]);
		}
		System.out.println(Arrays.deepToString(a));
		System.out.println(Arrays.toString(b));
	}
}