#31739: java


jbuduoo@gmail.com (戴先生)


package com.jb;

import java.util.Scanner;

public class Test {

    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        int S = num.nextInt();
        while (S > 0 && num.hasNext()) {

                int a = num.nextInt();
                int b = num.nextInt();
                int c = num.nextInt();
                int d = num.nextInt();
                String A = num.nextLine();

                // 等差數列
                if (b - a == d - c ) {
                    System.out.println(a + " " + b + " " + c + " " + d + " " + ( d + b - a));
                }
                // 等比數列
                else {
                    System.out.println(a + " " + b + " " + c + " " + d + " " + (d * d / c));
                }
                System.out.println("");

            S--;
        }

        num.close();
    }

}