This page is still under construction.

Parts of this page are still being built. What you see may change.

Minimum and Maximum 2

Interview

Time limit1sMemory limit256 MB

Summary
For each of T test cases, read N integers and print the smallest and largest value separated by a space.
Level

Easy1 of 10

Topics
Array, Implementation
Solved
No attempts yet

Problem

You are given N integers. Write a program that finds the minimum and the maximum.

Input

The first line gives the number of test cases T (1 ≤ T ≤ 10). Each test case consists of two lines.

The first line of each test case gives the number of integers N (1 ≤ N ≤ 1,000,000). The second line gives N integers separated by spaces. Every integer is greater than or equal to -1,000,000 and less than or equal to 1,000,000.

Output

For each test case, print the minimum and the maximum of the given N integers, separated by a space, one test case per line in order.

Examples1

  1. Example 1

    Input
    3
    5
    20 28 22 25 21
    5
    30 21 17 25 29
    5
    20 10 35 30 7
    
    Expected output
    20 28
    17 30
    7 35