URI Online Judge | 2247

Grandma Vitória's Piggy Banks

By OBI - Olimpíada Brasileira de Informática 2003 BR Brazil

Timelimit: 1

Grandma Victoria maintains since the birth of the grandsons Hansel and Zezinho , a ritual that is the delight of boys. She keeps all the coins received as change in two small piggy banks, one for each grandson. When one of piggy banks becomes full, she calls the two grandsons for a lively lunch at the end of which the delivery boys saved the coins in each piggy banks.

She was always very zealous about the equal distribution of the collected change. Where by reason of the value of coins, she can not put the same amount in the two piggy banks, she memorizes the difference in order to make up for it next deposit.

Grandma Victoria is getting old and is afraid that memory lapses to do commit injustices with her grandsons, failing to compensate for differences between the piggy banks. Your task is to help Grandma Victoria, writing a computer program that displays the differences between the deposits, so that it does not have to worry about memorizing them.


The input consists of several test sets. The first line of a test set contains an integer N (0 ≤ N ≤ 100), indicating the number of deposits in piggy banks. The N following lines describe each of a deposit in piggy banks; the deposit is indicated by two integer values J e Z (0 ≤ J,Z ≤ 100), separated by a blank space, representing respectively the values in cents, deposited in the vaults of the grandsons Hansel and Zezinho. The end of input is indicated by N = 0.


For each input set of test his program to produce a set of rows in the output. The first line should contain a test set identifier in the format "Teste n", where n is sequentially numbered from 1. Then your program must write one line for each tank set of tests. Each line should contain an integer representing the difference (in cents) between the amount deposited in piggy banks of Hansel and Zezinho. Let a blank line at the end of each test set. The spelling shown in Example output below should be followed strictly.

Input Sample Output Sample


20 25

10 5

10 10


0 5

12 0

0 20

17 1


Teste 1




Teste 2