This page is still under construction.

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

Namuk's Chicken Coop

Time limit2sMemory limit256 MB

Summary
From the total number of legs and chickens, find how many chickens lost a leg and how many are intact.
Level

Easy1 of 10

Topics
Math
Solved
No attempts yet

Problem

Namuk runs an egg shop and collects eggs from his chicken coop every day. One day he walked in and found that some of the chickens had lost a leg. He wanted to know how many chickens had lost a leg, but there were far too many to count one by one, so he counted every leg in the coop instead.

An intact chicken has two legs, and a chicken that lost a leg has one. Given the total number of legs and the number of chickens, solve Namuk's problem for him.

Input

The first line contains the number of test cases TT (T≤25T \le 25).

Each of the next TT lines contains the total number of chicken legs NN (1≤N≤3001 \le N \le 300) and the number of chickens MM (M≤N≤2MM \le N \le 2M), separated by a space.

Output

For each test case, print the number of chickens that lost a leg and the number of intact chickens on one line, separated by a space.

Examples5

  1. Example 1

    Input
    2
    5 3
    7 5
    
    Expected output
    1 2
    3 2
    
  2. Example 2

    Input
    1
    4 4
    
    Expected output
    4 0
    
  3. Example 3

    Input
    1
    10 5
    
    Expected output
    0 5
    
  4. Example 4

    Input
    1
    1 1
    
    Expected output
    1 0
    
  5. Example 5

    Input
    1
    2 1
    
    Expected output
    0 1