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 pi = pair<int, int>;
const int MAXN = 400005;
int n, m, s, t;
vector<pi> gph[MAXN];
vector<pi> backedg[MAXN];
int par[MAXN], ord[MAXN], stk[MAXN], piv;
void dfs(int x, int p) {
  stk[x] = 1;
  ord[x] = ++piv;
  for (auto &i : gph[x]) {
    if (i.first == p) continue;
    if (!ord[i.second]) {
      par[i.second] = x;
      dfs(i.second, i.first);
    } else if (stk[i.second]) {
      backedg[ord[i.second]].emplace_back(x, i.second);
    }
  }
  stk[x] = 0;
}
vector<int> get_st_order() {
  dfs(s, -1);
  if (piv != n) return {};
  vector<vector<int>> ears;
  vector<int> mark(n + 1);
  int cyc = 0;
  for (int i = 1; i <= n; i++) {
    for (auto &j : backedg[i]) {
      vector<int> v = {j.second, j.first};
      for (int k = j.first; k != j.second; k = par[k]) {
        if (mark[k]) break;
        mark[k] = 1;
        v.push_back(par[k]);
      }
      ears.push_back(v);
    }
  }
  if (((int)(ears).size()) == 0 || ears[0].front() != ears[0].back()) return {};
  for (int i = 1; i < ((int)(ears).size()); i++) {
    if (ears[i].front() == ears[i].back()) return {};
  }
  for (int i = 1; i <= n; i++) {
    if (i != s && !mark[i]) return {};
  }
  vector<int> dp(n + 1);
  vector<pi> intv(n + 1);
  for (int i = ((int)(ears).size()) - 1; i >= 1; i--) {
    for (int j = 1; j + 1 < ((int)(ears[i]).size()); j++) {
      dp[ears[i][0]] += 1 + dp[ears[i][j]];
    }
  }
  for (int j = 0; j + 1 < ((int)(ears[0]).size()); j++) {
    intv[ears[0][j]].second = intv[ears[0][j]].first + dp[ears[0][j]] + 1;
    if (j + 2 < ((int)(ears[0]).size()))
      intv[ears[0][j + 1]].first = intv[ears[0][j]].second;
  }
  for (int i = 1; i < ((int)(ears).size()); i++) {
    if (intv[ears[i][0]] < intv[ears[i].back()]) {
      pi curIntv = intv[ears[i][0]];
      for (int j = ((int)(ears[i]).size()) - 2; j >= 1; j--) {
        intv[ears[i][j]] =
            pi(curIntv.second - dp[ears[i][j]] - 1, curIntv.second);
        curIntv.second -= dp[ears[i][j]] + 1;
      }
      intv[ears[i][0]] = curIntv;
    } else {
      pi curIntv = intv[ears[i][0]];
      for (int j = ((int)(ears[i]).size()) - 2; j >= 1; j--) {
        intv[ears[i][j]] =
            pi(curIntv.first, curIntv.first + dp[ears[i][j]] + 1);
        curIntv.first += dp[ears[i][j]] + 1;
      }
      intv[ears[i][0]] = curIntv;
    }
  }
  vector<int> dap(n);
  for (int i = 1; i <= n; i++) {
    assert(intv[i].first + 1 == intv[i].second);
    dap[intv[i].first] = i;
  }
  return dap;
}
int main() {
  int tc;
  scanf("%d", &tc);
  while (tc--) {
    scanf("%d %d %d %d", &n, &m, &s, &t);
    gph[s].emplace_back(m, t);
    gph[t].emplace_back(m, s);
    for (int i = 0; i < m; i++) {
      int s, t;
      scanf("%d %d", &s, &t);
      gph[s].emplace_back(i, t);
      gph[t].emplace_back(i, s);
    }
    auto P = get_st_order();
    if (((int)(P).size())) {
      puts("Yes");
      vector<int> rev(n + 1);
      vector<pi> ans(m);
      for (int i = 0; i < ((int)(P).size()); i++) rev[P[i]] = i;
      for (int i = 1; i <= n; i++) {
        for (auto &j : gph[i]) {
          if (j.first != m && rev[j.second] > rev[i]) {
            ans[j.first] = pi(i, j.second);
          }
        }
      }
      for (auto &i : ans) printf("%d %d\n", i.first, i.second);
    } else
      puts("No");
    for (int i = 1; i <= n; i++) {
      gph[i].clear();
      backedg[i].clear();
      ord[i] = 0;
    }
    piv = 0;
  }
}