**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lll __int128
#define uint unsigned int
#define ull unsigned long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define vi vector<int>
#define eb emplace_back
#define po pop_back
#define par __builtin_parity
#define pct __builtin_popcount
#define ctz __builtin_ctz
#define clz __builtin_clz
#define gcd __gcd
#define fi first
#define se second
#define mid ((l+r)/2)
const int N=1e6+5,INF=1e9,MOD=998244353;
int T,n,m,rt,invn,f[N],g[N],fa[N],d[N],bt[N],ch[N][2];
pii a[N];
int qpow(int x,int y)
{
	int res=1;
	for(;y;y/=2,x=1ll*x*x%MOD) if(y&1)
		res=1ll*res*x%MOD;
	return res;
}
void upd(int x,int w)
{
	for(;x<=n;x+=x&-x)
		bt[x]=max(bt[x],w);
}
int qry(int x)
{
	int res=0;
	for(;x;x-=x&-x)
		res=max(res,bt[x]);
	return res;
}
int build(int l,int r)
{
	if(l==r) return l;
	int p=n+mid;
	ch[p][0]=build(l,mid);
	ch[p][1]=build(mid+1,r);
	fa[ch[p][0]]=fa[ch[p][1]]=p;
	return p;
}
void dfs(int u,int f)
{
	if(!u) return;d[u]=d[f]+1;
	dfs(ch[u][0],u);dfs(ch[u][1],u);
}
int lca(int u,int v)
{
	if(d[u]<d[v]) swap(u,v);
	while(d[u]>d[v]) u=fa[u];
	while(u!=v) u=fa[u],v=fa[v];
	return u;
}
int get(int u) {return ch[fa[u]][1]==u;}
int calc(int u,int v,int l,int r)
{
	int res=1;
	if(!u)
	{
		for(int i=v;i!=rt;i=fa[i])
			if(get(i) && fa[i]!=n+v)
				res=1ll*res*(r-1)%MOD*invn%MOD;
		return res;
	}
	if(!v)
	{
		for(int i=u;i!=rt;i=fa[i])
			if(!get(i) && fa[i]!=n+u)
				res=1ll*res*(n-l+1)%MOD*invn%MOD;
		return res;
	}
	int t=lca(u,v);
	if(t!=n+u && t!=n+v) res=1ll*res*(r-l)%MOD*invn%MOD;
	for(int i=v;fa[i]!=t;i=fa[i])
		if(get(i) && fa[i]!=n+u && fa[i]!=n+v)
			res=1ll*res*(r-1)%MOD*invn%MOD;
	for(int i=u;fa[i]!=t;i=fa[i])
		if(!get(i) && fa[i]!=n+u && fa[i]!=n+v)
			res=1ll*res*(n-l+1)%MOD*invn%MOD;
	return res;
}
void slv()
{
	scanf("%d %d",&n,&m);
	if(n==1) {puts("1");return;}
	invn=qpow(n,MOD-2);
	for(int i=1;i<=n*2;++i) fa[i]=ch[i][0]=ch[i][1];
	rt=build(1,n);
	dfs(rt,0);
	for(int i=1;i<=m;++i)
		scanf("%d %d",&a[i].fi,&a[i].se);
	sort(a+1,a+m+1);
	a[m+1].se=n;
	fill(bt+1,bt+n+1,0);
	for(int i=1;i<=m;++i)
	{
		f[i]=qry(a[i].se)+1;
		if(a[i].fi>1 && a[i].se==1) f[i]=0;
		if(a[i].fi<n && a[i].se==n) f[i]=0;
		if(f[i]>0) upd(a[i].se,f[i]);
	}
	f[m+1]=qry(n)+1;
	g[0]=1;
	for(int i=1;i<=m+1;++i)
	{
		g[i]=0;
		for(int j=0;j<i;++j) if(a[i].se>=a[j].se && f[i]==f[j]+1)
			g[i]=(g[i]+1ll*g[j]*calc(a[j].fi,a[i].fi,a[j].se,a[i].se))%MOD;
		if(i<=m) g[i]=1ll*g[i]*invn%MOD;
	}
	printf("%d %lld\n",m+1-f[m+1],1ll*g[m+1]*qpow(n,n)%MOD);
}
int main()
{
	scanf("%d",&T);
	while(T--) slv();
	return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
2
5 3
1 1
2 2
3 3
5 4
1 1
2 2
4 3
5 4
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
def binary_search(n, k, arr):
    l = 1
    h = n
    while l < h:
        m = (l + h) // 2
        if arr[m-1] < k:
            l = m + 1
        else:
            h = m
    return l

def check_val(n, tests, removed_tests, arr):
    for i, (x, k) in enumerate(tests):
        if i in removed_tests:
            continue

            return False

        if binary_search(n, k, arr) != x:
            return False
    return True

def solvec(n, m, tests):
    MOD = 998244353

    for r in range(m + 1):
        valid_arrays = set()

        from itertools import combinations
        for removed in combinations(range(m), r):

            def gen_arr(pos=0, current_arr=None):
                if current_arr is None:
                    current_arr = [0] * n

                if pos == n:

                    arr_tuple = tuple(current_arr)
                    if check_val(n, tests, removed, current_arr):
                        valid_arrays.add(arr_tuple)
                    return

                fixed = False
                fixed_value = None
                for i, (x, k) in enumerate(tests):
                    if i not in removed and x-1 == pos:
                        fixed = True
                        fixed_value = k
                        break

                if fixed:
                    current_arr[pos] = fixed_value
                    gen_arr(pos+1, current_arr)
                else:

                    for val in range(1, n+1):
                        current_arr[pos] = val
                        gen_arr(pos+1, current_arr)

            gen_arr()

        if valid_arrays:
            return r, len(valid_arrays) % MOD

    return m, 0
def main():
    t = int(input())
    for _ in range(t):
        n, m = map(int, input().split())
        tests = []
        for _ in range(m):
            x, k = map(int, input().split())
            tests.append((x, k))

        r, count = solvec(n, m, tests)
        print(f"{r} {count}")

if __name__ == "__main__":
    main()

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
2
5 3
1 2
3 1
5 4
5 5
1 2
2 3
3 4
4 5
5 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
#pragma GCC optimize("Ofast","unroll-all-loops","fast-math","no-stack-protector")
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#if 1
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '['; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "]";}
void _print() {cerr << endl << flush;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define DEBUG(x...) cerr << "*["<<__LINE__<<"]\t"<< #x << " = "; _print(x)
template<class T>
istream& operator>>(istream& is, vector<T>& v) {
	int n; is>>n; v.resize(n);
	for(auto &i:v) is>>i;
	return is;
}
template<class T1,class T2>
istream& operator>>(istream& is, pair<T1,T2>& p) {
	is>>p.fi>>p.se;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	for(const auto &i:v) os<<i<<' ';
	return os;
}
template<class T1,class T2>
ostream& operator<<(ostream& os, const pair<T1,T2>& p) {
	os<<p.fi<<' '<<p.se; return os;
}
#endif

#define ll long long
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pi pair<int, int>
#define mod 998244353
template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;}
template<typename T> bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;}
ll ksm(ll a, ll b) {if (b == 0) return 1; ll ns = ksm(a, b >> 1); ns = ns * ns % mod; if (b & 1) ns = ns * a % mod; return ns;}

const int maxn = 3005;
int mn[maxn];
int mx[maxn];
void build(int l, int r) {
    if (l == r) return;
    int mid = (l + r) >> 1;
    chkmin(mn[mid], l);
    chkmax(mx[mid], r);
    build(mid + 1, r);
    build(l, mid);
}
int val[maxn];
int mxlen[maxn];
int dp[maxn];
int cnt[2][maxn];
int main() {
    int t;
    cin >> t;
    while (t--) {
        int m, n;
        cin >> n >> m;
        memset(val, -1, sizeof(val));
        for (int i = 1; i <= n; i++)
            mx[i] = i, mn[i] = i;
        build(1, n);
        for (int i = 1; i <= m; i++) {
            int pos, v;
            cin >> pos >> v;
            val[pos] = v;
        }
        memset(dp, 0, sizeof(dp));
        memset(mxlen, 0, sizeof(mxlen));
        val[0] = 0;
        val[n + 1] = n + 1;
        mxlen[n + 1] = 0;
        dp[n + 1] = 1;
        for (int i = n; i >= 0; i--) {
            if (val[i] == -1) {
                mxlen[i] = 0;
                dp[i] = 0;
                continue;
            }
            for (int j = i + 1; j <= n + 1; j++)
                if (val[j] != -1 && val[j] > val[i])
                    chkmax(mxlen[i], mxlen[j] + 1);
            memset(cnt, 0, sizeof(cnt));
            int h[2][2]; memset(h, 0, sizeof(h));
            for (int j = i + 1; j <= n + 1; j++) {
                for (int s = 0; s < 2; s++) {
                    h[s][1] -= cnt[s][j - 1];
                    h[s][0] += cnt[s][j - 1];
                }
                if (val[j] != -1 && val[j] > val[i] && mxlen[i] == mxlen[j] + 1) {
                    ll mult = 1;
                    for (int u = 0; u < 2; u++)
                        for (int v = 0; v < 2; v++) {
                            int L = 1, R = n;
                            if (u == 1) L = max(L, val[i]);
                            if (v == 1) R = min(R, val[j] - 1);
                            mult = mult * ksm(R - L + 1, h[u][v]) % mod;
                        }
                    dp[i] = (dp[i] + dp[j] * mult % mod) % mod;
                }
                int tu = 0;
                if (mn[j] <= i) tu = 1;
                cnt[tu][mx[j]] += 1;
                h[tu][1] += 1;
            }
        }
        cout << m + 1 - mxlen[0] << ' ' << dp[0] << endl;
    }
    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
5 5
1 5
2 4
3 3
4 2
5 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
#include<bits/stdc++.h>
using namespace std;
const int N = 3e5;
const int mod = 998244353;
int n, m;
struct dpnode{
    int nr, nr2;
}dp[N];
void add(dpnode &a, dpnode b){
    if(b.nr2 == 0)return;
    if(a.nr < b.nr){
        a = b;
    }else if(a.nr == b.nr){
        a.nr2 = (a.nr2 + b.nr2)%mod;
    }
}
int fastexp(int a, int b){
    assert(b >= 0);
    int r = 1;
    while(b){
        if(b&1)r = 1ll*r*a%mod;
        a = 1ll*a*a%mod;
        b/=2;
    }
    return r;
}
vector <int> touch(int x){
    vector <int> p;
    int l = 0, r = n - 1;
    while(l != r){
        int mij = (l + r)/2;
        p.push_back(mij);
        if(x <= mij){
            r = mij;
        }else{
            l = mij + 1;
        }
    }
    return p;
}
struct ev{
    int pos, t;
}v[N];
dpnode dp2[N], dp3[N];
int v2[N];
void solve(){
    cin>>n>>m;
    for(int i = 0;i < n;i++){
        dp[i] = {-mod, 0};
        dp2[i] = {-mod, 0};
        dp3[i] = {-mod, 0};
        v2[i] = 0;
    }
    for(int i = 0;i < m;i++){
        int x, p;
        cin>>p>>x;
        p--;
        v[i] = {p, x};
        v2[p] = x;
    }
    sort(v, v + m,[&](ev a, ev b){
         return a.t < b.t;
    });
    for(int i = 0;i < m;i++){
        auto x = touch(v[i].pos);
        int nr = fastexp(n, v[i].pos);
        for(auto j:x){
            if(j < v[i].pos){
                nr = 1ll*nr*fastexp(n, mod - 2)%mod*(v[i].t - 1)%mod;
            }
        }
        add(dp[v[i].pos], {1, nr});
        /// find the before
        nr = 0;
        int nr2 = 0;
        for(auto j:x){
            if(j == v[i].pos){
                break;
            }
            if(j < v[i].pos){
                ///targeting this point
                assert(dp2[j].nr == dp3[j].nr);
                nr2 = 0;
                for(auto k:x){
                    if(j < k && k < v[i].pos)nr2++;
                }
                add(dp[v[i].pos], {dp2[j].nr + 1, 1ll*dp2[j].nr2*fastexp(v[i].t - 1, nr2)%mod*v[i].t%mod*fastexp(n, v[i].pos - j - 1 - nr2)%mod});
                add(dp[v[i].pos], {dp3[j].nr + 1, mod - 1ll*dp3[j].nr2*fastexp(v[i].t - 1, nr2)%mod*fastexp(n, v[i].pos - j - 1 - nr2)%mod});
                add(dp[v[i].pos], {dp[j].nr + 1, 1ll*dp[j].nr2*fastexp(v[i].t - 1, nr2)%mod*fastexp(n, v[i].pos - j - 1 - nr2)%mod});
            }
            ///exactly this point!
        }
        /// what occurs when lca is i or j?
        /// bruteforce dp
        /// find the after
        for(auto j:x){
            if(j == v[i].pos){
                break;
            }
            if(v[i].pos < j){
                ///v[i].pos -> j
                nr2 = 0;
                for(auto k:x){
                    if(v[i].pos < k && k < j)nr2++;
                }
                add(dp2[j], {dp[v[i].pos].nr, 1ll*dp[v[i].pos].nr2*fastexp(n - v[i].t + 1, nr2)%mod*fastexp(n, j - v[i].pos - nr2 - 1)%mod});
                add(dp3[j], {dp[v[i].pos].nr, 1ll*dp[v[i].pos].nr2*fastexp(n - v[i].t + 1, nr2)%mod*v[i].t%mod*fastexp(n, j - v[i].pos - nr2 - 1)%mod});
                if(nr2 != 0 && v2[j] > v[i].t){
                    add(dp[j], {dp[v[i].pos].nr + 1, 1ll*dp[v[i].pos].nr2*fastexp(n - v[i].t + 1, nr2 - 1)%mod*fastexp(n, j - v[i].pos - nr2 - 1)%mod*(v2[j] - v[i].t)%mod});
                }else if(v2[j] > v[i].t){
                    add(dp[j], {dp[v[i].pos].nr + 1, 1ll*dp[v[i].pos].nr2*fastexp(n, j - v[i].pos - nr2 - 1)%mod});
                }
            }
        }
    }
    dpnode ans = {0, fastexp(n, n)};
    for(int i = 0;i < n;i++){
        if(!v2[i])continue;
        auto x = touch(i);
        int cnt = 0;
        for(auto j:x){
            if(i < j)cnt++;
        }
        add(ans, {dp[i].nr, 1ll*dp[i].nr2*fastexp(n - v2[i] + 1, cnt)%mod*fastexp(n, n - i - 1 - cnt)%mod});
    }
    cout<<m - ans.nr<<' '<<ans.nr2<<'\n';
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin>>t;
    while(t--)solve();
    return 0;
}
/**
**/

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll MOD = 998244353;

int t;
int n, k;
int arr[3002];
int DPans[3002];
bool valid[3002];
ll DPcnt[3002];
int S[3002], E[3002];

void binary(int l, int r){
    if(l==r) return;
    int m = (l+r)/2;
    S[m] = l, E[m] = r;
    binary(l, m);
    binary(m+1, r);
}

int cnt1[3002][3002], cnt2[3002][3002], cnt3[3002][3002], cnt4[3002][3002];
ll powtable[3002][3002];

inline ll calc(int l, int r, ll vl, ll vr){
    return powtable[vr-vl+1][cnt1[l][r]] * powtable[n-vl+1][cnt2[l][r]] % MOD
         * powtable[vr][cnt3[l][r]] % MOD * powtable[n][cnt4[l][r]] % MOD;
}

int main(){
    for(int i=0; i<=3001; i++){
        powtable[i][0] = 1;
        for(int j=1; j<=3001; j++) powtable[i][j] = powtable[i][j-1]*i%MOD;
    }

    scanf("%d", &t);
    while(t--){
        scanf("%d %d", &n, &k);
        for(int i=1; i<=n; i++) arr[i] = -1, valid[i] = 0;
        for(int i=1; i<=k; i++){
            int x, v;
            scanf("%d %d", &x, &v);
            arr[x] = v;
            if(!(x>1&&v==1)) valid[x] = 1;
        }

        binary(1, n);
        S[n] = E[n] = n;

        fill(DPans+1, DPans+n+1, 0);
        fill(DPcnt+1, DPcnt+n+1, 0);

        for(int i=1; i<=n; i++){
            if(!valid[i]) continue;
            DPans[i] = 1;
            for(int j=1; j<i; j++) if(valid[j] && arr[j] < arr[i]) DPans[i] = max(DPans[i], DPans[j] + 1);
        }

        int longest = *max_element(DPans+1, DPans+n+1);

        for(int i=0; i<=n+1; i++) for(int j=0; j<=n+1; j++) cnt1[i][j] = cnt2[i][j] = cnt3[i][j] = cnt4[i][j] = 0;

        /// board 채우기
        /// 1. B1 (s<=l, r<=e)
        for(int i=1; i<=n; i++) cnt1[S[i]][E[i]]++, cnt1[i][E[i]]--, cnt1[S[i]][i]--, cnt1[i][i]++;
        for(int i=1; i<=n+1; i++) for(int j=0; j<=n+1; j++) cnt1[i][j] += cnt1[i-1][j];
        for(int j=n; j>=0; j--) for(int i=0; i<=n+1; i++) cnt1[i][j] += cnt1[i][j+1];

        /// 2. B2 (s<=l, e<r)
        for(int i=1; i<=n; i++) cnt2[S[i]][E[i]+1]++, cnt2[i][E[i]+1]--;
        for(int i=1; i<=n+1; i++) for(int j=0; j<=n+1; j++) cnt2[i][j] += cnt2[i-1][j];
        for(int j=1; j<=n+1; j++) for(int i=0; i<=n+1; i++) cnt2[i][j] += cnt2[i][j-1];

        /// 3. B3 (l<s, r<=e)
        for(int i=1; i<=n; i++) cnt3[S[i]-1][E[i]]++, cnt3[S[i]-1][i]--;
        for(int i=n; i>=0; i--) for(int j=0; j<=n+1; j++) cnt3[i][j] += cnt3[i+1][j];
        for(int j=n; j>=0; j--) for(int i=0; i<=n+1; i++) cnt3[i][j] += cnt3[i][j+1];

        /// 4. B4
        for(int i=1; i<=n; i++) cnt4[S[i]-1][E[i]+1]++;
        for(int i=n; i>=0; i--) for(int j=0; j<=n+1; j++) cnt4[i][j] += cnt4[i+1][j];
        for(int j=1; j<=n+1; j++) for(int i=0; i<=n+1; i++) cnt4[i][j] += cnt4[i][j-1];

//        printf("DPans: "); for(int i=1; i<=n; i++) printf("%d ", DPans[i]); puts("");
//        printf("cnt1: \n");
//        for(int i=0; i<=n+1; i++){
//            for(int j=0; j<=n+1; j++) printf("%d ", cnt1[i][j]);
//            puts("");
//        }

        ll ans = 0;
        for(int i=1; i<=n; i++){
            if(arr[i] == -1) continue;
            if(DPans[i] == 1){
                DPcnt[i] = calc(0, i, 1, arr[i]-1);
                continue;
            }
            for(int j=1; j<i; j++){
                if(valid[j] && arr[j] < arr[i] && DPans[j] + 1 == DPans[i]){
                    DPcnt[i] = (DPcnt[i] + DPcnt[j] * calc(j, i, arr[j], arr[i]-1)) % MOD;
                }
            }
            if(DPans[i] == longest){
                ans = (ans + DPcnt[i] * calc(i, n+1, arr[i], n)) % MOD;
            }
        }
        printf("%d %lld\n", k-longest, ans);
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To expose the bug in the provided code, we need to focus on edge cases or scenarios that are likely to cause issues. Here are the key points to consider:

1. **Array with All Elements Unsorted**: The binary search code assumes some form of sorting, which can lead to issues if the array is completely unsorted.
2. **Duplicate Values**: The code should handle duplicate values correctly, but the binary search might not work as expected.
3. **Edge Cases for Binary Search**: Ensure the binary search logic is tested with edge cases like the first and last elements of the array.
4. **Large Number of Tests**: Test cases with a large number of tests to ensure the algorithm handles the constraints correctly.

Given these considerations, let's create a small-scale test input that can expose potential issues in the code.

### Test Input
```plaintext
2
5 4
1 1
2 2
3 3
4 4
5 5
5 4
1 1
2 2
4 3
5 4
```

### Explanation
1. **First Test Case**:
   - Array: [1, 2, 3, 4, 5]
   - Tests: (1, 1), (2, 2), (3, 3), (4, 4), (5, 5)
   - This is a sorted array, and all tests should be correct. The expected output is `0 1`.

2. **Second Test Case**:
   - Array: [1, 2, 3, 4, 5]
   - Tests: (1, 1), (2, 2), (4, 3), (5, 4)
   - This array has a test (4, 3) which is incorrect. The expected output is `1 3` because removing the test (4, 3) makes all remaining tests correct.

This test input should help identify issues with the binary search logic and the handling of incorrect tests.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int N=3005,mod=998244353;
int n,m,rt,tot,lca[N][N],fa[N*2],ls[N*2],rs[N*2],fd[N*2],to[N*2],a[N],g[N];
ll fc[N],inv[N],pw[N],f[N];
ll qp(ll a,int b){ll ans=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ans=ans*a%mod;return ans;}
ll C(int n,int m){return n<m||m<0?0:fc[n]*inv[m]%mod*inv[n-m]%mod;}
void init(int n) {
    fc[0]=pw[0]=1;
    for(int i=1;i<=n;i++)fc[i]=fc[i-1]*i%mod,pw[i]=pw[i-1]*2%mod;
    inv[n]=qp(fc[n],mod-2);
    for(int i=n-1;~i;i--)inv[i]=inv[i+1]*(i+1)%mod;
}
int bd(int l,int r) {
    if(l==r)return to[l]=l;
    int mid=l+r>>1,p=++tot;to[p]=mid;
    for(int i=l;i<=mid;i++)for(int j=mid+1;j<=r;j++)lca[i][j]=p;
    ls[p]=bd(l,mid),rs[p]=bd(mid+1,r);
    return fd[ls[p]]=0,fd[rs[p]]=1,fa[ls[p]]=fa[rs[p]]=p;
}
void solve() {
    cin>>n>>m,tot=n,rt=bd(1,n),fa[rt]=0;
    ll iv=qp(n,mod-2);
    for(int i=1;i<=n;i++)a[i]=0;
    for(int i=1,x,k;i<=m;i++)cin>>x>>k,a[x]=k;
    int as=0;
    for(int i=1;i<=n;i++)if(a[i]) {
        g[i]=(a[i]!=1||i==1?1:-n);
        for(int j=1;j<i;j++)if(a[j]&&a[j]<a[i])g[i]=max(g[i],g[j]+1);
        as=max(as,g[i]);
    }
    ll way=!as;
    for(int i=1;i<=n;i++)if(a[i]) {
        f[i]=0;
        if(g[i]==1) {
            f[i]=iv;
            for(int x=fa[i];fa[x];x=fa[x])if(fd[x])f[i]=f[i]*(a[i]-1)%mod*iv%mod;
        }
        for(int j=1;j<i;j++)if(a[j]&&a[j]<a[i]&&g[j]+1==g[i]) {
            int lc=lca[j][i];
            ll v=f[j];
            for(int x=j;fa[x]!=lc;x=fa[x])if(to[fa[x]]!=j&&!fd[x])v=v*(n-a[j]+1)%mod*iv%mod;
            for(int x=i;fa[x]!=lc;x=fa[x])if(fd[x])v=v*(a[i]-1)%mod*iv%mod;
            if(to[lc]!=j)v=v*(a[i]-a[j])%mod*iv%mod;
            f[i]=(f[i]+v*iv)%mod;
        }
        if(g[i]==as) {
            ll v=f[i];
            for(int x=i;fa[x];x=fa[x])if(to[fa[x]]!=i&&!fd[x])v=v*(n-a[i]+1)*iv%mod;
            way=(way+v)%mod;
        }
    }cout<<m-as<<' '<<way*qp(n,n)%mod<<'\n';
}
int main() {
    #ifndef ONLINE_JUDGE
        freopen(".in","r",stdin);
        freopen(".out","w",stdout);
    #endif
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int tt;cin>>tt;
    while(tt--)solve();
    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
#include <bits/stdc++.h>

using namespace std;

namespace Combo {
    const int mod = 998244353;
    vector<int> f = {1}, invf = {1};
    int mul(int x, int y) {
        return (1LL * x * y) % mod;
    }
    int exp(int x, int y) {
        int ret = 1;
        while(y) {
            if(y & 1) ret = mul(ret, x);
            x = mul(x, x), y >>= 1;
        }
        return ret;
    }
    int fact(int x) {
        if(x < 0) return 0;
        while(x >= f.size()) {
            f.push_back(mul(f.size(), f.back()));
        }
        return f[x];
    }
    int ifact(int x) {
        if(x < 0) return 0;
        while(x >= invf.size()) {
            invf.push_back(mul(exp(invf.size(), mod - 2), invf.back()));
        }
        return invf[x];
    }
    int inv(int x) {
        return mul(fact(x - 1), ifact(x));
    }
    int ncr(int x, int y) {
        if(x < y || x < 0) return 0;
        return mul(fact(x), mul(ifact(x - y), ifact(y)));
    }
}

using namespace Combo;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int t; cin >> t;
    while(t--) {
        int n, m; cin >> n >> m;
        vector<int> fix(n, -1), pn(n + 1, 1);
        for(int i = 0, x, k; i < m; i++) {
            cin >> x >> k; --x, --k; fix[x] = k;
        }
        for(int i = 1; i <= n; i++) {
            pn[i] = mul(pn[i - 1], n);
        }
        vector<int> par(n, -1), st(n + 2, -1); int inv_n = exp(n, mod - 2);
        auto gen = [&](auto rec, int l, int r, int p) -> void {
            int mid = (l + r) / 2;
            if(l == r) {
                st[l + 1] = p;
                return;
            }
            par[mid] = p;
            rec(rec, l, mid, mid);
            rec(rec, mid + 1, r, mid);
        };
        gen(gen, 0, n - 1, -1); map<int, int> mp;
        auto get_btw = [&](int x, int y) {
            int res = 1, tx = st[x + 1], ty = st[y + 1];
            while(true) {
                if(tx == -1 && ty == -1) break;
                if(x < tx && tx < y) mp[tx] |= 2;
                if(x < ty && ty < y) mp[ty] |= 1;
                if(tx == ty) break;
                if(tx != -1) tx = par[tx];
                if(ty != -1) ty = par[ty];
            }
            for(auto [_, msk]: mp) {
                if(msk == 3) res = mul(res, mul(inv_n, fix[y] - fix[x]));
                if(msk == 2) res = mul(res, mul(inv_n, n - fix[x]));
                if(msk == 1) res = mul(res, mul(inv_n, fix[y]));
            }
            mp.clear();
            return res;
        };
        vector<int> dp1(n, 0), dp2(n); int res1 = 0, res2 = 0;
        for(int i = 0; i < n; i++) {
            if(fix[i] == -1) continue;
            dp1[i] = 1;
            dp2[i] = mul(pn[i], get_btw(-1, i));
            if(dp2[i] == 0) dp1[i] = 0;
            for(int j = 0; j < i; j++) {
                if(fix[j] == -1 || fix[j] > fix[i]) continue;
                if(dp1[j] + 1 > dp1[i]) {
                    int btw = get_btw(j, i);
                    dp1[i] = dp1[j] + 1;
                    dp2[i] = mul(dp2[j], mul(pn[i - j - 1], btw));
                } else if(dp1[j] + 1 == dp1[i]) {
                    int btw = get_btw(j, i);
                    dp2[i] = (dp2[i] + mul(dp2[j], mul(pn[i - j - 1], btw))) % mod;
                }
            }
            res1 = max(res1, dp1[i]);
        }
        for(int i = 0; i < n; i++) {
            if(dp1[i] != res1) continue;
            res2 = (res2 + mul(dp2[i], mul(pn[n - i - 1], get_btw(i, n)))) % mod;
        }
        if(res1 == m) res2 = 1;
        cout << m - res1 << " " << res2 << '\n';
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
2
3 3
1 2
2 1
3 3
5 4
1 5
2 4
3 3
4 2
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pr pair<int,int>
const int N=3005,mods=998244353,inf=1e9;
int n,m,t,a[N],b[N],dy[N],pw[N],bh[N][N],idx;
map<pr,pr>q[2][N];
pr hb(pr a,pr b){
	if(a.first==b.first)return {a.first,(a.second+b.second)%mods};
	if(a.first>b.first)return a;
	return b;
}
pr mul(pr a,pr b){
	return {a.first+b.first,a.second*b.second%mods};
}
pr solve(int l,int r,int a,int b,int op){
	if(l>r)return {0,1};
	if(a>b)return {0,pw[r-l]};
	if(l==r){
		if(a<=dy[l]&&b>=dy[l])return {op,1};
	    return {0,1};
	}
	if(!bh[l][r])bh[l][r]=++idx;
	if(q[op][bh[l][r]].count({a,b}))return q[op][bh[l][r]][{a,b}];
	int mid=l+r>>1;
	pr res={-inf,0};
	for(int i=1;i<=n;i++){
		if(i!=dy[mid])res=hb(res,mul(solve(l,mid,a,min(b,i),0),solve(mid+1,r,max(a,i+1),b,op)));
		else res=hb(res,mul(solve(l,mid,a,min(b,i),1),solve(mid+1,r,max(a,i+1),b,op)));
	}
	return q[op][bh[l][r]][{a,b}]=res;
}
signed main(){
	//freopen("in.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>t;
	while(t--){
		cin>>n>>m;
		pw[0]=1;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				bh[i][j]=0;
			}
			q[0][i].clear();
			q[1][i].clear();
		}
		for(int i=1;i<=n;i++)dy[i]=0,pw[i]=pw[i-1]*n%mods;
		for(int i=1;i<=m;i++)cin>>a[i]>>b[i],dy[a[i]]=b[i];
		pr res;
		if(dy[n]){
			auto r1=solve(1,n,1,n,1),r2=solve(1,n,1,n,0);
			r2.second=r2.second*(n-1)%mods;
			res=hb(r1,r2);
		}else{
			res=solve(1,n,1,n,0);
			res.second=res.second*n%mods;
		}
		cout<<m-res.first<<" "<<res.second<<"\n";
	}
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
2
3 3
1 2
2 1
3 3
4 4
1 1
2 2
3 3
4 4
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int N = 3050;
const int mod = 998244353;
vector<int> path[N];
int oper[N],dp[N],cnt[N],used[N],it;
void build(vector<int> a, int l, int r){
    if(l > r)return;
    if(l == r){
        path[l] = a;
        return;
    }
    int mid = (l + r) / 2;
    a.pb(mid);
    build(a, mid + 1, r);
    build(a, l, mid);
}
void add(int &x, int y){
    x += y;
    if(x >= mod)x -= mod;
}
int binpow(int a,int n){
    int rt = 1;
    while(n){
        if(n & 1){
            rt = (rt * 1ll * a) % mod;
        }
        a = (a * 1ll * a) % mod;
        n >>= 1;
    }
    return rt;
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int qq;
    cin >> qq;
    while(qq--){
        int n,m;
        cin >> n >> m;
        for(int i = 0;i <= n + 1;i++){
            oper[i] = -1;
            dp[i] = cnt[i] = 0;
        }
        for(int i = 1;i <= m;i++){
            int j,x;
            cin >> j >> x;
            oper[j] = x;
        }
        vector<int> tmp;
        build(tmp, 1, n);
        oper[0] = 0;
        assert(path[n + 1].empty());
        oper[n + 1] = n + 1;
        int mx = 0;
        cnt[0] = 1;
        for(int i = 1;i <= n + 1;i++){
            if(oper[i] == -1)continue;
            for(int j = i - 1;j >= 0;j--){
                if(oper[j] == -1)continue;
                if(oper[j] >= oper[i])continue;
                if(dp[j] + (i <= n) < dp[i])continue;
                int kol = 0;
                ++it;
                int cntA = 0,cntB = 0,cntb = 0;
                for(int el: path[j]){
                    if((el <= j) || (el >= i))continue;
                    used[el] = it;
                    cntA++;
                }
                for(int el: path[i]){

                    if((el <= j) || (el >= i))continue;
                    if(used[el] == it){
                        cntA--;
                        cntb++;
                    }else{
                        cntB++;
                    }
                }
                int vA = (n - oper[j] + 1);
                int vB = oper[i] - 1;
                int vb = oper[i] - oper[j];

                kol = (binpow(vA, cntA) * 1ll * binpow(vB, cntB)) % mod;
                kol = (kol * 1ll * binpow(vb, cntb)) % mod;
                int ost = i - j - 1 - cntA - cntB - cntb;
                assert(ost >= 0);
                kol = (binpow(n, ost) * 1ll * kol) % mod;
                kol = (kol * 1ll * cnt[j]) % mod;
                if(dp[j] + (i <= n) == dp[i]){
                    add(cnt[i], kol);
                }else if(kol > 0){
                    cnt[i] = kol;
                    dp[i] = dp[j] + (i <= n);
                }
            }
            mx = max(mx, dp[i]);
        }
        assert(mx > 0);
        cout << m - dp[n + 1] << ' ' << cnt[n + 1];
        cout << '\n';
        int res = 0;
        for(int i = 1;i <= n;i++){
            if(oper[i] == -1)continue;
            if(dp[i] == mx){

            }
        }
        for(int i = 1;i <= n;i++){
            path[i].clear();
        }
    }
    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 2
1 2
2 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
// Cao Quang Hung
#include<bits/stdc++.h>

using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<long long , long long>
#define vi vector<int>
#define vpii vector<pii>
#define SZ(x) ((int)(x.size()))
#define fi first
#define se second
#define IN(x,y) ((y).find((x))!=(y).end())
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define FOR(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define dem(x) __builtin_popcount(x)
#define Mask(x) (1LL << (x))
#define BIT(x, i) ((x) >> (i) & 1)
#define ln '\n'
#define io_faster ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
///mt19937 rnd(time(0));

const int INF = 1e9 , mod = 998244353;

template <class T1, class T2>
inline T1 mul(T1& x, const T2 &k){ return x = (1LL * x * k) % mod; }

template <class T1 , class T2>
inline T1 pw(T1 x, T2 k){T1 res = 1; for (; k ; k >>= 1){ if (k & 1) mul(res, x); mul(x, x); } return res;}

template <class T>
inline bool minimize(T &x, const T &y){ if (x > y){x = y; return 1;} return 0; }

template <class T>
inline bool maximize(T &x, const T &y){ if (x < y){x = y; return 1;} return 0; }

template <class T>
inline void add(T &x , const T &y){ if ((x += y) >= mod) x -= mod; }

template <class T>
inline T product (const T &x , const T &y) { return 1LL * x * y % mod; }

#define PROB "a"
void file(){
    if(fopen(PROB".inp", "r")){
        freopen(PROB".inp","r",stdin);
        freopen(PROB".out","w",stdout);
    }
}
void sinh_(){
//    srand(time(0));
//    freopen(PROB".inp" , "w" , stdout);
//    int n;
}

typedef long long ll;
typedef double db;
const int N = 3e3 + 5;

int n, m, a[N];
pii test[N], dp[N];
vector<int> touch[N];
int p[N][N];

void readip(){
    cin >> n >> m;
    REP(i, 1, n) a[i] = 0, touch[i].clear();

    REP(i, 1, m) cin >> test[i].first >> test[i].second;
    sort(test + 1, test + m + 1);

    REP(i, 1, m) {
        int val = test[i].first;
        a[val] = test[i].second;

        int l = 1, r = n;

        while(l < r) {
            int mid = (l + r) >> 1;
            touch[val].eb(mid);

            if (val <= mid)
                r = mid;
            else
                l = mid + 1;
        }
    }

    p[0][0] = 1;
    REP(i, 1, n+1) {
        p[i][0] = 1;
        REP(j, 1, n+1) p[i][j] = product(p[i][j - 1], i);
    }
}

bool marki[N], markboth[N];
void solve(){
    REP(i, 1, n) dp[i] = make_pair(0, 0);
    dp[0] = make_pair(0, 1);

    REP(i, 1, n) {
        if (a[i] == 0 ||(i > 1 && a[i] == 1)) continue;

        REPD(j, i - 1, 0) if (a[j] < a[i] && dp[j].first >= dp[i].first) {
            vector<int> both, I, J;
            for (auto &pos : touch[i]) if (j < pos && pos < i) marki[pos] = true;

            for (auto &pos : touch[j]) if (j < pos && pos < i) {
                if (marki[pos]) both.eb(pos), markboth[pos] = true;
                else J.eb(pos);
            }

            for (auto &pos : touch[i]) if (j < pos && pos < i) {
                marki[pos] = false;
                if (markboth[pos]) markboth[pos] = false;
                else I.eb(pos);
            }

            int numBoth = both.size();
            int numI = I.size();
            int numJ = J.size();

            int numway = 1LL * dp[j].second
                       * 1LL * p[n][i - j - 1 - numBoth - numI - numJ] % mod
                       * 1LL * p[a[i] - a[j]][numBoth] % mod
                       * 1LL * p[n - a[j] + 1][numJ] % mod
                       * 1LL * p[a[i] - 1][numI] % mod;

            if (dp[j].first > dp[i].first) {
                dp[i].first = dp[j].first;
                dp[i].second = numway;
            }
            else {
                add(dp[i].second, numway);
            }
        }
        ++dp[i].first;
    }

    int mx = -1, res;
    REP(i, 1, n) {
        int cnt = 0;
        for (auto it : touch[i]) cnt += it > i;
        mul(dp[i].second, product(p[n][n - i - cnt], p[n - a[i] + 1][cnt]));
        if (dp[i].first > mx) {
            mx = dp[i].first;
            res = dp[i].second;
        }
        else if (dp[i].first == mx) {
            add(res, dp[i].second);
        }
    }
    cout << m - mx << ' ' << res << ln;
}

int main(){
    sinh_();
    io_faster
    file();
    int t = 1;
   cin >> t;
    while (t--){
        readip();
        solve();
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the provided code, we need to focus on edge cases and scenarios that can highlight the issues in the binary search implementation and the dynamic programming logic. Here are the steps to create such a test input:

1. **Understand the Bug**: The code uses a binary search on an unsorted array, which is fundamentally flawed. Additionally, the dynamic programming logic might have issues with counting the number of valid arrays.

2. **Edge Cases**:
   - **Small Array Size**: Test with small values of `n` and `m` to ensure the code handles small inputs correctly.
   - **Single Test Case**: Test with a single test case to see if the code can handle the simplest scenario.
   - **Multiple Test Cases**: Test with multiple test cases to ensure the code can handle multiple scenarios.
   - **All Tests Correct**: Test with an array where all tests are correct.
   - **All Tests Incorrect**: Test with an array where all tests are incorrect.
   - **Mixed Tests**: Test with an array where some tests are correct and some are incorrect.

3. **Challenging Scenarios**:
   - **Non-Contiguous Indices**: Test with non-contiguous indices to ensure the code can handle gaps in the array.
   - **Repeating Values**: Test with repeating values in the array to see if the code can handle duplicates.

4. **Example Test Input**:
   - **Small Array with Mixed Tests**: This will test the code's ability to handle a small array with a mix of correct and incorrect tests.

Here is a small-scale test input that meets these criteria:

```plaintext
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
```

### Explanation:
- **Test Case 1**:
  - `n = 5`, `m = 4`
  - Tests: (1, 1), (2, 2), (4, 3), (5, 4)
  - This array can be constructed as `[1, 2, 2, 3, 4]`, which satisfies all tests, so `r = 0` and there is only one such array.
- **Test Case 2**:
  - `n = 5`, `m = 4`
  - Tests: (5, 4), (2, 5), (1, 2), (3, 3)
  - Removing the test (2, 5) makes the remaining tests correct. The possible arrays are `[2, 2, 3, 1, 4]`, `[2, 2, 3, 2, 4]`, `[2, 2, 3, 3, 4]`, so `r = 1` and there are 3 such arrays.

This test input should help expose the bug in the provided code.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int N=3005,mod=998244353;
int n,m,rt,tot,lca[N][N],fa[N*2],ls[N*2],rs[N*2],fd[N*2],to[N*2],a[N],g[N];
ll fc[N],inv[N],pw[N],f[N];
ll qp(ll a,int b){ll ans=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ans=ans*a%mod;return ans;}
ll C(int n,int m){return n<m||m<0?0:fc[n]*inv[m]%mod*inv[n-m]%mod;}
void init(int n) {
    fc[0]=pw[0]=1;
    for(int i=1;i<=n;i++)fc[i]=fc[i-1]*i%mod,pw[i]=pw[i-1]*2%mod;
    inv[n]=qp(fc[n],mod-2);
    for(int i=n-1;~i;i--)inv[i]=inv[i+1]*(i+1)%mod;
}
int bd(int l,int r) {
    if(l==r)return to[l]=l;
    int mid=l+r>>1,p=++tot;to[p]=mid;
    for(int i=l;i<=mid;i++)for(int j=mid+1;j<=r;j++)lca[i][j]=p;
    ls[p]=bd(l,mid),rs[p]=bd(mid+1,r);
    return fd[ls[p]]=0,fd[rs[p]]=1,fa[ls[p]]=fa[rs[p]]=p;
}
void solve() {
    cin>>n>>m,tot=n,rt=bd(1,n),fa[rt]=0;
    ll iv=qp(n,mod-2);
    for(int i=1;i<=n;i++)a[i]=0;
    for(int i=1,x,k;i<=m;i++)cin>>x>>k,a[x]=k;
    int as=0;
    for(int i=1;i<=n;i++)if(a[i]) {
        g[i]=(a[i]!=1||i==1?1:-n);
        for(int j=1;j<i;j++)if(a[j]&&a[j]<a[i])g[i]=max(g[i],g[j]+1);
        as=max(as,g[i]);
    }
    ll way=0;
    for(int i=1;i<=n;i++)if(a[i]) {
        f[i]=0;
        if(g[i]==1) {
            f[i]=iv;
            for(int x=fa[i];fa[x];x=fa[x])if(fd[x])f[i]=f[i]*(a[i]-1)%mod*iv%mod;
        }
        for(int j=1;j<i;j++)if(a[j]&&a[j]<a[i]&&g[j]+1==g[i]) {
            int lc=lca[j][i];
            ll v=f[j];
            for(int x=j;fa[x]!=lc;x=fa[x])if(to[fa[x]]!=j&&!fd[x])v=v*(n-a[j]+1)%mod*iv%mod;
            for(int x=i;fa[x]!=lc;x=fa[x])if(fd[x])v=v*(a[i]-1)%mod*iv%mod;
            if(to[lc]!=j)v=v*(a[i]-a[j])%mod*iv%mod;
            f[i]=(f[i]+v*iv)%mod;
        }
        if(g[i]==as) {
            ll v=f[i];
            for(int x=i;fa[x];x=fa[x])if(to[fa[x]]!=i&&!fd[x])v=v*(n-a[i]+1)*iv%mod;
            way=(way+v)%mod;
        }
    }cout<<m-as<<' '<<way*qp(n,n)%mod<<'\n';
}
int main() {
    #ifndef ONLINE_JUDGE
        freopen(".in","r",stdin);
        freopen(".out","w",stdout);
    #endif
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int tt;cin>>tt;
    while(tt--)solve();
    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
#pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;

#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);}
#else
#define debug(...) 7122
#endif

#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second

const int MOD = 998244353;
const int SIZE = 3005;

int n, m;
int mx, ans;
int pw[SIZE];
vector<int> p[SIZE];
pair<int, int> a[SIZE], dp[SIZE];

int power(int d, int up) {
    int re = 1;
    while (up) {
        if (up & 1) re = 1ll * re * d % MOD;
        d = 1ll * d * d % MOD;
        up >>= 1;
    }
    return re;
}

void solve() {
    cin >> n >> m;
    FOR (i, 1, m) cin >> a[i].F >> a[i].S;
    sort(a + 1, a + m + 1);
    pw[0] = 1;
    FOR (i, 1, n) {
        int l = 1, r = n;
        p[i].clear();
        pw[i] = 1ll * pw[i - 1] * n % MOD;
        while (l < r) {
            int mid = (l + r) / 2;
            p[i].pb(mid);
            if (i <= mid) r = mid;
            else l = mid + 1;
        }
        sort(p[i].begin(), p[i].end());
    }
    mx = ans = 0;
    FOR (i, 1, m) {
        dp[i] = {-1, 0};
        if (a[i].F > 1 && a[i].S == 1) continue;
        FOR (j, 1, i - 1) if (a[j].S < a[i].S && dp[j].F + 1 >= dp[i].F) {
            if (dp[j].F + 1 > dp[i].F) dp[i] = {dp[j].F + 1, 0};
            int len = a[i].F - a[j].F - 1, pro = 1;
            for (int pj = 0, pi = 0;;) {
                while (pj < p[a[j].F].size() && (p[a[j].F][pj] <= a[j].F || p[a[j].F][pj] >= a[i].F)) pj++;
                while (pi < p[a[i].F].size() && (p[a[i].F][pi] <= a[j].F || p[a[i].F][pi] >= a[i].F)) pi++;
                if (pj >= p[a[j].F].size() && pi >= p[a[i].F].size()) break;
                if (pj < p[a[j].F].size() && pi < p[a[i].F].size() && p[a[j].F][pj] == p[a[i].F][pi]) {
                    pro = 1ll * pro * (a[i].S - a[j].S) % MOD;
                    pj++, pi++, len--;
                    continue;
                }
                if (pj < p[a[j].F].size() && (pi == p[a[i].F].size() || p[a[j].F][pj] < p[a[i].F][pi])) {
                    pro = 1ll * pro * (n - a[j].S + 1) % MOD;
                    pj++, len--;
                } else {
                    pro = 1ll * pro * (a[i].S - 1) % MOD;
                    pi++, len--;
                }
            }
            pro = 1ll * pro * pw[len] % MOD;
            dp[i].S = (dp[i].S + 1ll * pro * dp[j].S) % MOD;
        }
        if (dp[i].F <= 0) {
            int c = lower_bound(p[a[i].F].begin(), p[a[i].F].end(), a[i].F) - p[a[i].F].begin();
            dp[i] = {1, 1ll * power(a[i].S - 1, c) * pw[a[i].F - 1 - c] % MOD};
        }
        if (dp[i].F > mx) {
            mx = dp[i].F;
            ans = 0;
        }
        if (dp[i].F == mx) {
            int c = upper_bound(p[a[i].F].begin(), p[a[i].F].end(), a[i].F) - p[a[i].F].begin();
            c = p[a[i].F].size() - c;
            ans = (ans + 1ll * dp[i].S * power(n - a[i].S + 1, c) % MOD * pw[n - a[i].F - c]) % MOD;
        }
    }
    cout << m - mx << ' ' << ans << '\n';
}

int main() {
    Waimai;
    int tt;
    cin >> tt;
    while (tt--) solve();
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
2
5 3
1 1
3 2
5 3
6 4
1 1
3 2
5 3
6 4
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Go Learn! (Easy Version)
time_limit_ms: 5000
memory_limit_mb: 256
Description: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.

Well, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.

Bessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\ldots,a_n]$ with $n$ elements.

              let l = 1     let h = n          while l < h:       let m = floor((l + h) / 2)            if a[m] < k:         l = m + 1       else:         h = m          return l

Bessie submitted her code to Farmer John's problem with $m$ ($1 \leq m \leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \leq x, k \leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.

Test $i$ is correct if the following hold:

  1. The $x_i$-th element in the array is $k_i$.    2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$.

It might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ so that all remaining tests are correct.

In addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\ldots,a_n]$ with $1 \leq a_i \leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\,244\,353$.

Input: The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \leq m \leq n \leq 3000$) denoting the number of the array and the number of tests.

The following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \leq x_i, k_i \leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.

It is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.

Output: For each test case, output two integers, $r$ — the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\,244\,353$.

Examples:
input:
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
output:
0 1
1 3

input:
2
6 6
1 3
2 5
3 1
4 2
5 4
6 6
30 8
19 22
6 12
12 1
28 27
3 4
14 25
29 14
11 15
output:
3 78
3 839271911

Note: Consider the first example.

In the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.

In the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,4]$.

Buggy Code:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 3e3;
const int mod = 998244353;
int add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
int sub(int x, int y) { return (x -= y) < 0 ? x + mod : x; }
int ksm(ll x, int tp, int s = 1)
{
    for (; tp; x = x * x % mod, tp >>= 1)
        if (tp & 1)
            s = x * s % mod;
    return s;
}
int n, m;
int v[N + 5];
vector<int> pos[N + 5];
void build(int l, int r, int x)
{
    if (l == r)
        return;
    int mid = l + r >> 1;
    pos[x].push_back(mid);
    if (x <= mid)
        build(l, mid, x);
    else
        build(mid + 1, r, x);
}
struct F
{
    int c, s;
    F(int c = 0, int s = 0) : c(c), s(s) {}
} f[N + 5];
int cal(int x, int y)
{
    static bool inx[N + 5];
    int a = 0, b = 0, c = 0;
    for (auto it : pos[x])
        if (it > x && it < y)
        {
            inx[it] = 1;
            a++;
        }
    for (auto it : pos[y])
        if (it > x && it < y)
        {
            b++;
            if (inx[it])
                c++;
        }
    a -= c;
    b -= c;
    return ksm(n, y - x - 1 - a - b - c, ksm(n - v[x] + 1, a, ksm(v[y] - 1, b, ksm(v[y] - v[x], c))));
}
void solve()
{
    scanf("%d %d", &n, &m);
    memset(v, -1, sizeof v);
    for (int i = 1, x; i <= m; i++)
    {
        scanf("%d", &x);
        scanf("%d", &v[x]);
    }
    for (int i = 1; i <= n; i++)
    {
        pos[i].clear();
        build(1, n, i);
    }
    int r = 0;
    for (int i = 1; i <= n; i++)
    {
        f[i] = {0, 0};
        if (v[i] == -1)
            continue;
        int a = 0;
        for (auto it : pos[i])
            a += it < i;
        int c = ksm(n, i - a - 1, ksm(v[i] - 1, a));
        if (c != 0)
            f[i] = {1, c};
        for (int j = 1; j < i; j++)
            if (v[j] != -1 && v[j] < v[i] && f[j].c + 1 >= f[i].c)
            {
                int coe = cal(j, i);
                if (f[j].c + 1 > f[i].c)
                    f[i] = F(f[j].c + 1, 1ll * f[j].s * coe % mod);
                else
                    f[i].s = (f[i].s + 1ll * f[j].s * coe % mod);
            }
        r = max(r, f[i].c);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++)
    {
        if (v[i] == -1)
            continue;
        if (f[i].c == r)
        {
            int a = 0;
            for (auto it : pos[i])
                a += it > i;
            int c = ksm(n, n - i - a, ksm(n - v[i] + 1, a));
            ans = (ans + 1ll * f[i].s * c) % mod;
        }
    }
    printf("%d %d\n", m - r, ans);
}
int main()
{
    int t = 100;
    scanf("%d", &t);
    while (t--)
        solve();
    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
2
5 4
1 1
2 2
4 3
5 4
5 4
5 4
2 5
1 2
3 3
```