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

bool solve (string s, string t)
{
	if ((s.length % 2) != (t.length % 2))
	{
		s = s[1..$];
	}
	int pos = 0;
	bool skip = false;
	foreach (ref c; s)
	{
		if (skip)
		{
			skip = false;
			continue;
		}
		if (t[pos] == c)
		{
			pos += 1;
		}
		else
		{
			skip = true;
		}
		if (pos == t.length)
		{
			return true;
		}
	}
	return false;
}

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto s = readln.strip;
		auto t = readln.strip;
		writeln (solve (s, t) ? "YES" : "NO");
	}
}
