1. 

//package U11448;

/**
* Applied mathematics, SS09, IFB 2C
* ACM Problem #11448 - Who said crisis?
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=26&problem=2443&mosmsg=Submission+received+with+ID+7135785
*
* @author Lermer Florian
* @author Hidir Sayli
* @author Taskin Umut
*
* Status : Accepted
* Runtime: 1.000
*
* Problems: !
*/

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class Main {

/**
* @param args
* @throws IOException
* @throws NumberFormatException
*/
public static void main(String[] args) throws NumberFormatException, IOException {
// TODO Auto-generated method stub
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int count=Integer.parseInt(br.readLine());
while(count>0)
{
StringTokenizer st=new StringTokenizer(br.readLine());
// BigInteger bi=new BigInteger(st.nextToken());
// System.out.println(bi.subtract(new BigInteger(st.nextToken())).toString());
System.out.println(new BigInteger(st.nextToken()).subtract(new BigInteger(st.nextToken())));
count--;
}
}

}