#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    int t, i, j, k, x, temp;
    int num1[10000], num2[10000];
    char c;
    bool f = true;
    cin >> t;

    while (t--)
    {
        for (i = 0; i < 10000; i++)
        {
            num1[i] = 0;
            num2[i] = 0;
        }
        i = 0;
        j = 0;
        while (!isspace(c = getchar()))
            num1[i++] = c - '0';
        while (!isspace(c = getchar()))
            num2[j++] = c - '0';
        x = i > j ? i : j;
        temp = 0;
        for (k = 0; k < x; k++)
        {
            i = temp + num1[k] + num2[k];
            if (f)
            {
                if (i % 10 != 0)
                {
                    f = false;
                    cout << i % 10;
                }
            }
            else cout << i % 10;
            temp = i / 10;
        }
        if (temp != 0)
            cout << temp;
        cout << endl;
        f = true;
    }
    return 0;
}