import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto s = readln.strip;
		auto n = s.length.to !(int);
		int p = 1;
		foreach (i; 1..n)
		{
			if (s[i - 1] + s[i] > '0' + '9')
			{
				p = i;
			}
		}
		writeln (s[0..p - 1], s[p - 1] + s[p] - '0' - '0',
		    s[p + 1..$]);
	}
}
