#2644 Horns

1 s   128 MB  

Description

Alan passed through the forest of horns. There are only two kinds of beasts, unicorns and
twinhorns, in this forest. Every unicorn has one horn on its head, and every twinhorn has two
horns on its head. Alan saw n horns and m beasts in total. Please write a program to compute
the number of unicorns and the number of twinhorns seen by Alan.

Input

The first line contains an integer $T$ indicating the number of test cases, where $T \leq 25$. Each
test case has exactly one line. This line contains two integers n and m separated by a blank,
where $1 \leq n \leq 300$ and $m \leq n \leq 2m$. Alan saw $n$ horns and $m$ beasts in total.

Output

For each test case, output one line containing two integers $u$ and $t$ separated by a blank, where
$u$ and $t$ are the number of unicorns and the number of twinhorns, respectively.

Sample Input

Sample Output

2
5 3
7 5
1 2
3 2

Source

2015 ACM-ICPC Taiwan Online Programming Contest