[pascal]

var

a, b : array[0..1000000]of integer;

cases, p, q, i, n : longint;

begin

readln(cases);

while cases > 0 do

begin

dec(Cases);

readln(n);

for i := 1 to n do readln(a

*, b*

*);*

p := 0;

for i := n downto 1 do

begin

q := ap := 0;

for i := n downto 1 do

begin

q := a

*+ b**+ p;*

aa

*:= q mod 10;*

p := q div 10;

end;

if p > 0 then

begin

write(p);

for i := 1 to n do

write(ap := q div 10;

end;

if p > 0 then

begin

write(p);

for i := 1 to n do

write(a

*);*

end

else

begin

write(a[1]);

for i := 2 to n do

write(aend

else

begin

write(a[1]);

for i := 2 to n do

write(a

*);*

end;

writeln;

writeln;

end;

end.

[/pascal]end;

writeln;

writeln;

end;

end.

[/pascal]