Problem: Berland consists of n cities and m bidirectional roads connecting pairs of cities. There is no road connecting a city to itself, and between any pair of cities there is no more than one road. It is possible to reach any city from any other moving along roads.

Currently Mr. President is in the city s and his destination is the city t. He plans to move along roads from s to t (s ≠ t).

That's why Ministry of Fools and Roads has difficult days. The minister is afraid that Mr. President could get into a traffic jam or get lost. Who knows what else can happen!

To be sure that everything goes as planned, the minister decided to temporarily make all roads one-way. So each road will be oriented in one of two possible directions. The following conditions must be satisfied:

  * There should be no cycles along roads after orientation. 
  * The city s should be the only such city that all its roads are oriented out (i.e. there are no ingoing roads to the city s and the city s is the only such city). 
  * The city t should be the only such city that all its roads are oriented in (i.e. there are no outgoing roads from the city t and the city t is the only such city). 



Help the minister solve his problem. Write a program to find any such orientation of all roads or report that no solution exists.

Input

Each test in this problem contains one or more test cases to solve. The first line of the input contains positive number T — the number of cases to solve.

Each case starts with a line containing four integers n, m, s and t (2 ≤ n ≤ 4·105, 1 ≤ m ≤ 106, 1 ≤ s, t ≤ n, s ≠ t) — the number of cities, the number of roads and indices of departure and destination cities. The cities are numbered from 1 to n.

The following m lines contain roads, one road per line. Each road is given as two integer numbers xj, yj (1 ≤ xj, yj ≤ n, xj ≠ yj), which means that the j-th road connects cities xj and yj. There is at most one road between any pair of cities. It is possible to reach any city from any other moving along roads.

The sum of values n over all cases in a test doesn't exceed 4·105. The sum of values m over all cases in a test doesn't exceed 106.

Output

For each case print "Yes" if the answer exists. In the following m lines print roads in the required directions. You can print roads in arbitrary order. If there are multiple answers, print any of them.

Print the only line "No" if there is no answer for a case.

Example

Input

2
4 4 1 2
1 2
2 3
3 4
4 1
3 2 1 3
3 1
2 3


Output

Yes
1 2
3 2
4 3
1 4
No

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int n, m, S, T;
vector<pair<int, int> > e[2111111], e1[2111111];
bool visd[2111111];
int x[2111111], y[2111111], dir[2111111];
int p[2111111], dep[2111111], pe_id[2111111], son[2111111], in_cnt[2111111],
    out_cnt[2111111];
int q[2111111 * 2];
bool paint(int e_id, int f) {
  if (dir[e_id] != -1) return false;
  dir[e_id] = f;
  if (f != (dep[x[e_id]] < dep[y[e_id]])) {
    in_cnt[y[e_id]]++;
    out_cnt[x[e_id]]++;
  } else {
    in_cnt[x[e_id]]++;
    out_cnt[y[e_id]]++;
  }
  return true;
}
void dfs(int cur, int par) {
  p[cur] = par;
  visd[cur] = true;
  for (int i = 0; i < e[cur].size(); i++) {
    int nxt = e[cur][i].first, id = e[cur][i].second;
    if (nxt == par) continue;
    if (visd[nxt] && dep[nxt] < dep[cur]) {
      int v = son[nxt];
      e1[cur].push_back(make_pair(v, id));
      e1[v].push_back(make_pair(cur, id));
      continue;
    }
    if (visd[nxt]) continue;
    pe_id[nxt] = id;
    son[cur] = nxt;
    dep[nxt] = dep[cur] + 1;
    dfs(nxt, cur);
  }
}
int main() {
  int CASE;
  for (scanf("%d", &CASE); CASE--;) {
    scanf("%d%d%d%d", &n, &m, &S, &T);
    for (int i = 1; i <= n; i++) {
      e[i].clear();
      e1[i].clear();
    }
    for (int i = 0; i < m; i++) {
      scanf("%d%d", &x[i], &y[i]);
      e[x[i]].push_back(make_pair(y[i], i));
      e[y[i]].push_back(make_pair(x[i], i));
    }
    dep[S] = 0;
    memset(visd, false, (n + 1) * sizeof(int));
    pe_id[S] = -1;
    dfs(S, -1);
    memset(visd, false, (n + 1) * sizeof(int));
    memset(in_cnt, 0, (n + 1) * sizeof(int));
    memset(out_cnt, 0, (n + 1) * sizeof(int));
    memset(dir, -1, m * sizeof(int));
    int l = 0, r = 0;
    q[r++] = T;
    q[r++] = 0;
    visd[T] = true;
    while (l < r) {
      int cur = q[l++], f = q[l++];
      while (pe_id[cur] >= 0 && paint(pe_id[cur], f)) {
        for (int i = 0; i < e1[cur].size(); i++) {
          int nxt = e1[cur][i].first, id = e1[cur][i].second;
          if (paint(id, f) && !visd[nxt]) {
            q[r++] = nxt;
            q[r++] = 1 - f;
            visd[nxt] = true;
          }
        }
        cur = p[cur];
      }
    }
    bool sol = true;
    for (int i = 0; i < m && sol; i++)
      if (dir[i] == -1) sol = false;
    for (int i = 1; i <= n && sol; i++) {
      if (i == S && (out_cnt[i] == 0 || in_cnt[i] > 0)) sol = false;
      if (i == T && (in_cnt[i] == 0 || out_cnt[i] > 0)) sol = false;
      if (i != S && i != T && (!in_cnt[i] || !out_cnt[i])) sol = false;
    }
    if (!sol)
      printf("No\n");
    else {
      printf("Yes\n");
      for (int i = 0; i < m; i++) {
        if (dir[i] == (dep[x[i]] < dep[y[i]])) swap(x[i], y[i]);
        printf("%d %d\n", x[i], y[i]);
      }
    }
  }
  return 0;
}