Go: package main

import (
        "fmt"
        "bufio"
        "os"
)

func main() {
        var n int
        var a, b string
        sc := bufio.NewScanner(os.Stdin)
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                sc.Scan()
                a = sc.Text()
                sc.Scan()
                b = sc.Text()

                if len(a) > len(b) {
                        s := add(a, b)
                        if s[len(a)] > 0 {
                                if len(a) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(a)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                } else {
                        s := add(b, a)
                        if s[len(b)] > 0 {
                                if len(b) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(b)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                }
        }
}

// expects ln > lm
func add(n string, m string) (s [100]int) {
        ln := len(n)
        lm := len(m)
        var sum [100]int

        for i := 0; i < ln; i++ {
                var s, t int
                s = int(n[ln-1-i]) - int('0')

                if lm - 1 - i >= 0 {
                        t = int(m[lm-1-i]) - int('0')
                } else {
                        t = 0
                }

                sum[i+1] = (s + t + sum[i]) / 10
                sum[i] = (s + t + sum[i]) % 10
        }

        return sum
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
  
using namespace std;
  
int main(){
      
    int n;
    cin>>n;
      
    while(n-- > 0){
        vector<int> ans;
        vector<int> a;
        vector<int> b;
          
        string c,d;
        cin>>c>>d;
          
        for(int i = 0; i < (int)c.size(); ++i){
            a.push_back(c[c.size()-1-i]-'0');
        }
        for(int i = 0; i < (int)d.size(); ++i){
            b.push_back(d[d.size()-1-i]-'0');
        }
          
          
        int kuri = 0;
        while(!a.empty() || !b.empty() || kuri!=0){
            int sum = kuri;
            kuri = 0;
              
            if(!a.empty()){
                sum += a[0];
                a.erase(a.begin());
            }
              
            if(!b.empty()){
                sum += b[0];
                b.erase(b.begin());
            }
              
            ans.push_back(sum%10);
            kuri += sum/10;
        }
          
        if(ans.size()>80)puts("overflow");
        else{
            for(int i = 0; i < (int)ans.size(); ++i){
                printf("%d",ans[ans.size()-1-i]);
            }puts("");
        }
    }
      
}
 
/*
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
     
    int n;
    cin >> n;
     
    while(n-- > 0){
     
    string str1;
    cin >> str1;
     
    string str2;
    cin >> str2;
     
    reverse(str1.begin(), str1.end());
    reverse(str2.begin(), str2.end());
     
    int check;
    if(str1.size() > str2.size()){
        check = 1;
    }
    else if(str1.size() == str2.size()){
        check = 2;
    }
    else {
        check = 3;
    }
     
    int ans[100];
    bool next = false;
    int short_ = min(str1.size(), str2.size());
    int long_ = max(str1.size(), str2.size());  
    if(long_ >= 80){
        cout << "overflow" << endl;
        continue;
    }
 
    for(int i = 0; i < short_; ++i){
        int num = 0;
        num += (str1[i] - '0') + (str2[i] - '0');
        if(next){
            num++;
        }
        ans[i] = num;
        next = false;   
        if(num >= 10){
            num -= 10;
            ans[i] -= 10;
            next = true;
        }
    }
     
    if(check == 1){
        for(size_t i = str2.size(); i < str1.size(); ++i){
            int num = str1[i] - '0';
            if(next){
                num++;
            }
            ans[i] = num;
            next = false;   
            if(num >= 10){
                num -= 10;
                ans[i] -= 10;
                next = true;
            }
        }
        if(next){
            ans[str1.size()] = 1;
            long_ ++;
        }
    }   
     
    if(check == 3){
        for(size_t i = str1.size(); i < str2.size(); ++i){
            int num = str2[i] - '0';
            if(next){
                num++;
            }
            ans[i] = num;
            next = false;   
            if(num >= 10){
                num -= 10;
                ans[i] -= 10;
                next = true;
            }
        }
        if(next){
            ans[str2.size()] = 1;
            long_ ++;
        }
    }
     
    if(long_ >= 80){
        cout << "overflow" << endl;
        continue;
    }
 
    for(int i = long_ - 1; i >= 0; --i){
        cout << ans[i];
    }   
    cout << endl;
    }
         
    return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
	string a,b;
	vector<int> ans;
	int n,tmp,carry,num;
	bool flag = true;
	cin >> n;
	for(int i=0; i<n; i++){
		ans.clear();
		cin >> a >> b;
		int ai = a.size()-1;
		int bi = b.size()-1;
		carry=0;
		if(ai < 0 && bi < 0 && carry==0){
			flag = false;
		}
		while(ai >= 0 || bi >= 0){
			tmp=0;
			if(ai >= 0) tmp += a[ai] - '0';
			if(bi >= 0) tmp += b[bi] - '0';
			ans.push_back((tmp+carry)%10);
			carry = (tmp+carry)/10;
			ai--; bi--;
		}
		if(carry != 0) ans.push_back(carry);
		if(flag == true){
			if(ans.size() > 80){
				cout << "overflow" << endl;
				flag = false;
			}
			else{
				for(int j=ans.size()-1; j>=0; j--)
					cout << ans[j];
				cout << endl;
			}
		}
	}
	return 0;
}