// Pratiyush Mishra

#include <bits/stdc++.h>
#define ll long long int
using namespace std;

void mainSolve()
{
    int x, y;
    cin >> x >> y;
    int ans = x - y;
    cout << ans << endl;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t;
    cin >> t;
    while (t--)
    {
        mainSolve();
    }
    return 0;
}