Nezzar has a binary string s of length n that he wants to share with his best friend, Nanako. Nanako will spend q days inspecting the binary string. At the same time, Nezzar wants to change the string s into string f during these q days, because it looks better.

It is known that Nanako loves consistency so much. On the i-th day, Nanako will inspect a segment of string s from position l_i to position r_i inclusive. If the segment contains both characters '0' and '1', Nanako becomes unhappy and throws away the string.

After this inspection, at the i-th night, Nezzar can secretly change strictly less than half of the characters in the segment from l_i to r_i inclusive, otherwise the change will be too obvious.

Now Nezzar wonders, if it is possible to avoid Nanako being unhappy and at the same time have the string become equal to the string f at the end of these q days and nights.

Input

The first line contains a single integer t (1 ≤ t ≤ 2 ⋅ 10^5) — the number of test cases.

The first line of each test case contains two integers n,q (1 ≤ n ≤ 2 ⋅ 10^5, 0 ≤ q ≤ 2 ⋅ 10^5).

The second line of each test case contains a binary string s of length n.

The third line of each test case contains a binary string f of length n.

Then q lines follow, i-th of them contains two integers l_i,r_i (1 ≤ l_i ≤ r_i ≤ n) — bounds of the segment, that Nanako will inspect on the i-th day.

It is guaranteed that the sum of n for all test cases doesn't exceed 2 ⋅ 10^5, and the sum of q for all test cases doesn't exceed 2 ⋅ 10^5.

Output

For each test case, print "YES" on the single line if it is possible to avoid Nanako being unhappy and have the string f at the end of q days and nights. Otherwise, print "NO".

You can print each letter in any case (upper or lower).

Example

Input


4
5 2
00000
00111
1 5
1 3
2 1
00
01
1 2
10 6
1111111111
0110001110
1 10
5 9
7 10
1 7
3 5
6 10
5 2
10000
11000
2 5
1 3


Output


YES
NO
YES
NO

Note

In the first test case, \underline{00000} → \underline{000}11 → 00111 is one of the possible sequences of string changes.

In the second test case, it can be shown that it is impossible to have the string f at the end.
#include <bits/stdc++.h>

using namespace std;

#define int long long

const int maxn = 2e5;
pair <int, int> t[4 * maxn + 5];
int sum[4 * maxn + 5];
int a[maxn];

void push(int v, int l, int r) {
	if (t[v].first == -1) return;
	if (l == r - 1) {
		sum[v] = t[v].second;
		t[v] = {-1, -1};
		return;
	}
	t[2 * v] = max(t[2 * v], t[v]);
	t[2 * v + 1] = max(t[2 * v + 1], t[v]);
	sum[v] = t[v].second * (r - l);
	t[v] = {-1, -1};
}

void build(int v, int l, int r) {
	t[v] = {-1, -1};
	if (l == r - 1) {
		sum[v] = a[l];
		return;
	}
	int m = (l + r) / 2;
	build(2 * v, l, m);
	build(2 * v + 1, m, r);
	sum[v] = sum[2 * v] + sum[2 * v + 1];
}

void upd(int v, int l, int r, int tl, int tr, pair <int, int> val) {
	if (l >= tr || tl >= r) return;
	if (l <= tl && tr <= r) {
		t[v] = val;
		return;
	}
	push(v, tl, tr);
	int tm = (tl + tr) / 2;
	upd(2 * v, l, r, tl, tm, val);
	upd(2 * v + 1, l, r, tm, tr, val);
	int val1 = sum[2 * v];
	if (t[2 * v].first != -1) val1 = (tm - tl) * t[2 * v].second;
	int val2 = sum[2 * v + 1];
	if (t[2 * v + 1].first != -1) val2 = (tr - tm) * t[2 * v + 1].second;
	sum[v] = val1 + val2;
}

int get(int v, int l, int r, int tl, int tr) {
	if (l >= tr || tl >= r) return 0;
	if (l <= tl && tr <= r) {
		if (t[v].first == -1) return sum[v];
		return (tr - tl) * t[v].second;
	}
	push(v, tl, tr);
	int tm = (tl + tr) / 2;
	int ans1 = get(2 * v, l, r, tl, tm), ans2 = get(2 * v + 1, l, r, tm, tr);
	/*int val1 = sum[2 * v];
	if (t[2 * v].first != -1) val1 = (tm - tr) * t[2 * v].second;
	int val2 = sum[2 * v + 1];
	if (t[2 * v + 1].first != -1) val2 = (tr - tm) * t[2 * v + 1].second;
	sum[v] = val1 + val2;*/
	return ans1 + ans2;
}

void solve() {
	int n, q;
	cin >> n >> q;
	string s, f;
	cin >> s >> f;
	pair <int, int> seg[q];
	for (int i = 0; i < q; ++i) cin >> seg[i].first >> seg[i].second;
	for (int i = 0; i < n; ++i) a[i] = f[i] - '0';
	build(1, 0, n);
	int tmr = 0;
	for (int i = q - 1; i >= 0; --i) {
		int res = get(1, seg[i].first - 1, seg[i].second, 0, n);
		//cout << res << '\n';
		if (res * 2 == seg[i].second - seg[i].first + 1) {
			cout << "NO\n";
			return;
		}
		if (res * 2 > seg[i].second - seg[i].first + 1) upd(1, seg[i].first - 1, seg[i].second, 0, n, {tmr, 1});
		else upd(1, seg[i].first - 1, seg[i].second, 0, n, {tmr, 0});
		++tmr;
	}
	for (int i = 0; i < n; ++i) {
		if (get(1, i, i + 1, 0, n) != s[i] - '0') {
			cout << "NO\n";
			return;
		}
	}
	cout << "YES\n";
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin >> t;
	while (t) {
		--t;
		solve();
	}
	return 0;
}