JULKA - Julka


Julka surprised her teacher at preschool by solving the following riddle:

Klaudia and Natalia have 10 apples together, but Klaudia has two apples more than Natalia. How many apples does each of he girls have?

Julka said without thinking: Klaudia has 6 apples and Natalia 4 apples. The teacher tried to check if Julka's answer wasn't accidental and repeated the riddle every time increasing the numbers. Every time Julka answered correctly. The surprised teacher wanted to continue questioning Julka, but with big numbers she could't solve the riddle fast enough herself. Help the teacher and write a program which will give her the right answers.

Task

Write a program which

  • reads from standard input the number of apples the girls have together and how many more apples Klaudia has,
  • counts the number of apples belonging to Klaudia and the number of apples belonging to Natalia,
  • writes the outcome to standard output

Input

Ten test cases (given one under another, you have to process all!). Every test case consists of two lines. The first line says how many apples both girls have together. The second line says how many more apples Klaudia has. Both numbers are positive integers. It is known that both girls have no more than 10100 (1 and 100 zeros) apples together. As you can see apples can be very small.

Output

For every test case your program should output two lines. The first line should contain the number of apples belonging to Klaudia. The second line should contain the number of apples belonging to Natalia.

Example

Input:
10
2
[and 9 test cases more]

Output:
6
4
[and 9 test cases more]


hide comments
abc_c: 2016-01-07 14:41:16

AC in 1st go!!
My 23rd
Hurrahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!!!!!

cherag_0001: 2016-01-05 10:13:18

First try..!! :D

dokz: 2016-01-05 07:02:32

That's why I love C# :) Thanks, System.Numerics.BigInteger

rendmaster: 2016-01-05 06:12:23

THAAANKS, MY LOOORD!!

Guys, if you use !std::cin.eof() to check the end of the file, YOU WILL GET WRONG ANSWER. Just loop for 10 times trying to read the input, that's enough. Got 2 WA because of that T_T.

hugs

hassangarh: 2015-12-30 13:07:50

After 4 hours struggle
finally did it!!!

shikhar_gupta_: 2015-12-23 06:17:30

Thanks to everyone who wrote the corner cases here. I'll mention a few which helped me debug:-
114 6 (posted by dpdrmj)
Then the test cases by bunnycoder:-
0 0
2003 65
1000 998
5555 5555
also check 97 0

utkarsh5: 2015-12-17 16:25:23

Java BigInteger or Python, and its done. :)

shriyam_011: 2015-12-12 08:49:27

Dont use the standard functions like strrev or strcmp ,it costed me 4 WA.
The little tweaks you need to perform helps you develop a lot..

SidXDDD: 2015-12-11 15:30:34

Try this in c,c++ ...will be good for practice

algo_aris: 2015-12-09 17:53:28

Java BigInteger creates a magic :)

0.09 sec


Added by:Adam Dzedzej
Date:2004-06-08
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS PERL6 VB.NET
Resource:Internet Contest Pogromcy Algorytmow (Algorithm Tamers)
Round II, 2003