## Cross Coloring solution codeforces

There is a sheet of paper that can be represented with a grid of size n×mn×m — nn rows and mm columns of cells. All cells are colored in white initially.

qq operations have been applied to the sheet. The ii-th of them can be described as follows:

- xixi yiyi — choose one of kk non-white colors and color the entire row xixi and the entire column yiyi in it. The new color is applied to each cell, regardless of whether the cell was colored before the operation.

The sheet after applying all qq operations is called a coloring. Two colorings are different if there exists at least one cell that is colored in different colors.

## Cross Coloring solution codeforces

How many different colorings are there? Print the number modulo 998244353998244353.

The first line contains a single integer tt (1≤t≤1041≤t≤104) — the number of testcases.

The first line of the testcase contains four integers n,m,kn,m,k and qq (1≤n,m,k,q≤2⋅1051≤n,m,k,q≤2⋅105) — the size of the sheet, the number of non-white colors and the number of operations.

The ii-th of the following qq lines contains a description of the ii-th operation — two integers xixi and yiyi (1≤xi≤n1≤xi≤n; 1≤yi≤m1≤yi≤m) — the row and the column the operation is applied to.

The sum of qq over all testcases doesn’t exceed 2⋅1052⋅105.

For each testcase, print a single integer — the number of different colorings modulo 998244353998244353.

input

## Cross Coloring solution codeforces

2 1 1 3 2 1 1 1 1 2 2 2 3 2 1 1 1 2 2

output

3 4