import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Main{
    public static void main(String[] args) {
	try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();

	    int n = 0;

	    for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    }

	    br.close();

	    for (Integer i = 0; i < lines.size(); i++) {
		if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		}
	    }
	    System.exit(0);

	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	}
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util public class Main{
    public static void main(String[] args) {
	try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();

	    int n = 0;

	    for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    }

	    br.close();

	    for (Integer i = 0; i < lines.size(); i++) {
		if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		}
	    }
	    System.exit(0);

	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	}
    }
} Main public static void main(String[] args) {
	try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();

	    int n = 0;

	    for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    }

	    br.close();

	    for (Integer i = 0; i < lines.size(); i++) {
		if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		}
	    }
	    System.exit(0);

	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	}
    } main {
	try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();

	    int n = 0;

	    for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    }

	    br.close();

	    for (Integer i = 0; i < lines.size(); i++) {
		if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		}
	    }
	    System.exit(0);

	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	}
    } try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();

	    int n = 0;

	    for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    }

	    br.close();

	    for (Integer i = 0; i < lines.size(); i++) {
		if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		}
	    }
	    System.exit(0);

	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	} Exception e {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	} System.out.println(e.getMessage()) System.out.println System.out System System.out e.getMessage() e.getMessage e System.out.println(Arrays.toString(e.getStackTrace())) System.out.println System.out System System.out Arrays.toString(e.getStackTrace()) Arrays.toString Arrays e.getStackTrace() e.getStackTrace e System.exit(0) System.exit System 0 {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();

	    int n = 0;

	    for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    }

	    br.close();

	    for (Integer i = 0; i < lines.size(); i++) {
		if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		}
	    }
	    System.exit(0);

	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) List<String> lines = new ArrayList<String>(); lines new ArrayList<String>() int n = 0; n 0 for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    } String line = br.readLine(); String line = br.readLine(); line br.readLine() br.readLine br line != null line null line = br.readLine() line = br.readLine() line br.readLine() br.readLine br {
		lines.add(line);
	    } {
		lines.add(line);
	    } lines.add(line) lines.add lines line br.close() br.close br for (Integer i = 0; i < lines.size(); i++) {
		if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		}
	    } Integer i = 0; Integer i = 0; i 0 i < lines.size() i lines.size() lines.size lines i++ i++ i {
		if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		}
	    } {
		if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		}
	    } if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		} i==0 i 0 {
		    n = Integer.parseInt(lines.get(i));
		} n = Integer.parseInt(lines.get(i)) n Integer.parseInt(lines.get(i)) Integer.parseInt Integer lines.get(i) lines.get lines i {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		} String[] splits = lines.get(i).split(" "); splits lines.get(i).split(" ") lines.get(i).split lines.get(i) lines.get lines i " " List<Long> numbers = new ArrayList<Long>(); numbers new ArrayList<Long>() for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    } int j = 0; int j = 0; j 0 j < splits.length j splits.length splits splits.length j++ j++ j {
			numbers.add(j, Long.parseLong(splits[j]));
		    } {
			numbers.add(j, Long.parseLong(splits[j]));
		    } numbers.add(j, Long.parseLong(splits[j])) numbers.add numbers j Long.parseLong(splits[j]) Long.parseLong Long splits[j] splits j numbers.sort(Comparator.naturalOrder()) numbers.sort numbers Comparator.naturalOrder() Comparator.naturalOrder Comparator Long min = numbers.get(0); min numbers.get(0) numbers.get numbers 0 numbers.sort(Comparator.reverseOrder()) numbers.sort numbers Comparator.reverseOrder() Comparator.reverseOrder Comparator Long max = numbers.get(0); max numbers.get(0) numbers.get numbers 0 Long sum = 0L; sum 0L for (Long e : numbers) {
			sum += e;
		    } Long e numbers {
			sum += e;
		    } {
			sum += e;
		    } sum += e sum e System.out.println(String.format("%d %d %d", min, max, sum)) System.out.println System.out System System.out String.format("%d %d %d", min, max, sum) String.format String "%d %d %d" min max sum System.exit(0) System.exit System 0 String[] args args public class Main{
    public static void main(String[] args) {
	try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();

	    int n = 0;

	    for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    }

	    br.close();

	    for (Integer i = 0; i < lines.size(); i++) {
		if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		}
	    }
	    System.exit(0);

	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	}
    }
} public class Main{
    public static void main(String[] args) {
	try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();

	    int n = 0;

	    for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    }

	    br.close();

	    for (Integer i = 0; i < lines.size(); i++) {
		if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		}
	    }
	    System.exit(0);

	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	}
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Main{
    public static void main(String[] args) {
	try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();

	    int n = 0;

	    for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    }

	    br.close();

	    for (Integer i = 0; i < lines.size(); i++) {
		if (i==0) {
		    n = Integer.parseInt(lines.get(i));
		} else {
		    String[] splits = lines.get(i).split(" ");
		    List<Long> numbers = new ArrayList<Long>();
		    for ( int j = 0; j < splits.length; j++ ) {
			numbers.add(j, Long.parseLong(splits[j]));
		    }

		    numbers.sort(Comparator.naturalOrder());
		    Long min = numbers.get(0);
		    numbers.sort(Comparator.reverseOrder());
		    Long max = numbers.get(0);

		    Long sum = 0L;
		    for (Long e : numbers) {
			sum += e;
		    }

		    System.out.println(String.format("%d %d %d", min, max, sum));
		}
	    }
	    System.exit(0);

	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	}
    }
}