#include <iostream>
#include <cmath>
#include <vector>
#include <ios>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#define lol long long
//#define LIM 9999999
using namespace std;

//const lol mod=1e9+7;

int main() {
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lol T,a,b,c;
    cin >> T;
    while(T--){
        cin >> a >> b >> c;
        cout << a+b-c << endl;
    }
    return 0;
}