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;
struct edge {
  int x, y, d;
  edge(int _x, int _y, int _d) : x(_x), y(_y), d(_d) {}
  edge() {}
};
const int inf = 1e9;
const int maxn = 5e5 + 10;
const int maxm = 1e6 + 10;
int n, m, s, t;
vector<edge> e;
vector<vector<int> > g;
vector<int> low, num, vv;
int dfsnum;
stack<int> q;
int dfs1(int u, int pare) {
  low[u] = num[u] = dfsnum++;
  bool vist = false;
  for (int i = 0; i < g[u].size(); ++i) {
    int f = g[u][i];
    int v = e[f].x;
    if (v == u) v = e[f].y;
    if (v == pare) continue;
    if (num[v] == -1) {
      int x = dfs1(v, u);
      low[u] = min(low[u], low[v]);
      if (x == -1)
        return -1;
      else if (x == 1) {
        vist = true;
        e[f].d = 0;
        if (v == e[f].x) e[f].d = 1;
      } else {
        if (low[v] >= num[u]) {
          return -1;
        }
        e[f].d = 0;
        if (v == e[f].y) e[f].d = 1;
      }
    } else if (e[f].d == -1) {
      e[f].d = 0;
      if (v == e[f].y) e[f].d = 1;
      low[u] = min(low[u], num[v]);
    }
  }
  if (vist or u == t)
    return 1;
  else if (low[u] == num[u])
    return -1;
  else
    return 0;
}
void dfs22(int u, int pare, int unum, int l) {
  num[u] = dfsnum++;
  for (int i = 0; i < g[u].size(); ++i) {
    int f = g[u][i];
    int v = e[f].x;
    if (v == u) v = e[f].y;
    if (v == pare) continue;
    if (num[v] == -1) {
      if (unum == inf) {
        if ((v == e[f].x and e[f].d == 0) or (v == e[f].y and e[f].d == 1)) {
          dfs22(v, u, num[u], l);
        } else
          dfs22(v, u, unum, l);
      } else {
        if (low[v] >= unum) {
          dfs22(v, u, num[u], 1 ^ l);
          e[f].d = l;
          if (v == e[f].x) e[f].d = (l ^ 1);
        } else {
          dfs22(v, u, unum, l);
          e[f].d = l;
          if (v == e[f].y) e[f].d = (l ^ 1);
        }
      }
    } else if (num[v] < num[u]) {
      if (num[v] < unum) {
        e[f].d = l;
        if (v == e[f].y) e[f].d = (l ^ 1);
      } else {
        e[f].d = l;
        if (v == e[f].x) e[f].d = (l ^ 1);
      }
    }
  }
}
bool dfs2(int u, int pare) {
  vv[u] = 1;
  if (u == t) return true;
  for (int i = 0; i < g[u].size(); ++i) {
    int f = g[u][i];
    int v = e[f].x;
    if (v == u) v = e[f].y;
    if (v == pare) continue;
    if (vv[v]) continue;
    e[f].d = 0;
    if (v == e[f].x) e[f].d = 1;
    if (dfs2(v, u)) {
      q.push(u);
      return true;
    } else {
      e[f].d = -1;
    }
  }
  vv[u] = 0;
  return false;
}
void dfs3(int u, int pare) {
  for (int i = 0; i < g[u].size(); ++i) {
    int f = g[u][i];
    int v = e[f].x;
    if (v == u) v = e[f].y;
    if (v == pare) continue;
    if (e[f].d >= 0) continue;
    e[f].d = 0;
    if (v == e[f].x) e[f].d = 1;
    if (vv[v])
      continue;
    else {
      vv[v] = 1;
      dfs3(v, u);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int ncases;
  cin >> ncases;
  for (int cass = 0; cass < ncases; ++cass) {
    cin >> n >> m >> s >> t;
    --s;
    --t;
    g = vector<vector<int> >(n);
    e = vector<edge>(m);
    for (int i = 0; i < m; ++i) {
      int x, y;
      cin >> x >> y;
      --x;
      --y;
      g[x].push_back(i);
      g[y].push_back(i);
      e[i] = edge(x, y, -1);
    }
    low = num = vector<int>(n, -1);
    dfsnum = 0;
    int x = dfs1(s, -1);
    if (x == 1) {
      cout << "Yes\n";
      num = vector<int>(n, -1);
      dfsnum = 0;
      dfs22(s, -1, inf, 0);
      for (int i = 0; i < m; ++i) {
        if (e[i].d)
          cout << e[i].y + 1 << ' ' << e[i].x + 1 << '\n';
        else
          cout << e[i].x + 1 << ' ' << e[i].y + 1 << '\n';
      }
    } else
      cout << "No\n";
  }
}