#include
#include
using namespace std;
char result[1500];
char A[1001];
char B[1001];
int main()
{
int i, j, sum, takeOver, k, temp1, temp2, size, p = 1;
cin >> size;
while (size--)
{
memset(result, '0', sizeof(result));
memset(result, '0', sizeof(A));
memset(result, '0', sizeof(B));
cin >> A >> B;
i = 0, j = 0;
while(A[i] != '