#include <cstdio>
#include <cstring>
using namespace std;

const int MAXN = 200001;
int state[MAXN];

int main() {
    int T;
    scanf("%d", &T);
    while (T--) {
        int n, m, x, y;
        scanf("%d %d %d %d", &n, &m, &x, &y);
        // 重置状态数组,从 1 到 n
        for (int i = 1; i <= n; i++) {
            state[i] = 0;
        }
        int sumA = 0, sumB = 0;
        for (int i = 0; i < m; i++) {
            int p;
            scanf("%d", &p);
            int old = state[p];
            int new_val = 1 - old;
            state[p] = new_val;
            if (p <= x) {
                sumA += (new_val - old);
            }
            if (p >= y) {
                sumB += (new_val - old);
            }
            printf("%d %d\n", x - sumA, (n - y + 1) - sumB);
        }
    }
    return 0;
}