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;
using ll = long long;
using db = double;
using vi = vector<int>;
using pii = pair<int, int>;
const int mxn = 1000006;
int n, m, s, t;
vi e[mxn];
bool v[mxn];
int p[mxn];
bool ins[mxn];
vector<pii> path[mxn];
int a[mxn][20];
int h[mxn];
void dfs(int x, int p) {
  v[x] = true;
  h[x] = h[p] + 1;
  a[x][0] = p;
  ::p[x] = p;
  for (int i = 1; i < 20; ++i) a[x][i] = a[a[x][i - 1]][i - 1];
  for (auto i : e[x])
    if (!v[i]) {
      dfs(i, x);
    }
}
int jump(int x, int d) {
  for (int i = 20; i--;)
    if (d >> i & 1) x = a[x][i];
  return x;
}
int son(int o, int x) { return jump(x, h[x] - h[o] - 1); }
struct Splay {
  struct Node {
    int p, son[2];
    int &operator[](int s) { return son[s]; }
  } node[mxn];
  int sid(int x) { return x == node[node[x].p][1]; }
  void link(int x, int s, int y) {
    if (x) node[x][s] = y;
    if (y) node[y].p = x;
  }
  void cut(int x, int s, int y) { node[x][s] = node[y].p = 0; }
  void zig(int x) {
    int y = node[x].p, s = sid(x);
    link(y, s, node[x][!s]);
    link(node[y].p, sid(y), x);
    link(x, !s, y);
  }
  int splay(int x, int top = 0) {
    while (node[x].p && node[x].p != top) {
      int y = node[x].p;
      if (node[y].p && node[y].p != top) zig(sid(x) == sid(y) ? y : x);
      zig(x);
    }
    return x;
  }
  int next(int x, int s = 1) {
    for (splay(x), x = node[x][s]; node[x][!s]; x = node[x][!s]) {
    }
    return splay(x);
  }
  int ins(int x, int y, int s = 0) {
    next(x, s);
    link(x, s, y);
    return splay(y);
  }
  bool isleft(int x, int y, int s = 0) {
    splay(x, splay(y));
    return node[y][s] == x;
  }
} Q;
deque<int> q;
vector<pii> edge;
int d[mxn];
bool deb;
void foo(int x, int y) {
  vi s;
  while (!ins[y]) {
    ins[y] = true;
    q.push_back(y);
    s.push_back(y), y = p[y];
  }
  assert(x != y);
  assert(h[x] < h[y]);
  assert((Q.splay(x, Q.splay(y)), Q.node[x].p == y));
  if (!Q.isleft(x, y)) {
    swap(x, y);
    reverse(s.begin(), s.end());
  }
  int t = x;
  for (auto i : s) t = Q.ins(t, i, 1);
}
void check() {
  if (count(d + 1, d + n + 1, 0)) {
    puts("No");
    return;
  }
  for (int i = 1; i <= n; ++i) {
    int c[2] = {};
    for (auto j : e[i]) ++c[d[j] > d[i]];
    if (i == s && c[0]) {
      puts("No");
      return;
    }
    if (i == t && c[1]) {
      puts("No");
      return;
    }
    if (i != s && i != t && (!c[0] || !c[1])) {
      puts("No");
      return;
    }
  }
  puts("Yes");
  for (auto i : edge) {
    if (d[i.first] < d[i.second])
      printf("%d %d\n", i.first, i.second);
    else
      printf("%d %d\n", i.second, i.first);
  }
}
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    scanf("%d%d%d%d", &n, &m, &s, &t);
    edge = {};
    for (int i = 1; i <= n; ++i) Q.node[i] = {};
    Q.ins(s, t, 1);
    for (int i = 1; i <= n; ++i) e[i] = {};
    for (int i = 1; i <= m; ++i) {
      int x, y;
      scanf("%d%d", &x, &y);
      edge.push_back({x, y});
      e[x].push_back(y);
      e[y].push_back(x);
    }
    fill(v, v + n + 1, false);
    v[t] = true;
    p[t] = 0;
    h[t] = 1;
    fill(a[t], end(a[t]), 0);
    a[t][0] = t;
    dfs(s, t);
    if (count(v + 1, v + n + 1, false)) {
      puts("No");
      continue;
    }
    for (int i = 1; i <= n; ++i) path[i] = {};
    for (int i = 1; i <= n; ++i)
      for (auto j : e[i])
        if (h[j] > h[i] && p[j] != i) {
          path[i].push_back({i, j});
        }
    fill(ins, ins + n + 1, false);
    ins[t] = true;
    ins[s] = true;
    q = {};
    q.push_back(s);
    q.push_back(t);
    while (!q.empty()) {
      int x = q.front();
      q.pop_front();
      for (auto i : path[x]) {
        if (ins[son(i.first, i.second)]) {
          foo(i.first, i.second);
        } else {
          assert(i.first == x);
          path[son(i.first, i.second)].push_back(i);
        }
      }
      path[x] = {};
    }
    fill(d, d + n + 1, 0);
    int cnt = 0;
    for (int i = s; i; i = Q.next(i)) d[i] = ++cnt;
    if (!deb) check();
  }
  return 0;
}