#include <bits/stdc++.h>
using namespace std;
 
void mainSolve()
{
  int x,y;
  cin >>x>>y;

  cout<<abs(x-y)<<endl;
  
}
 
int main()
{
  int t;
  cin >> t;
  while (t--)
  {
    mainSolve();
  }
  return 0;
}