#include <bits/stdc++.h>
using namespace std;
int n, m, s, t;
vector<pair<int, int> > u[400005];
vector<tuple<int, int, int> > el;
vector<pair<int, int> > aux[400005];
bool hasST;
vector<int> chk[400005];
bool sn[1000005];
int dp[1000005];
int nxt[1000005];
int cc[1000005];
int ed[1000005];
int detp[1000005];
int par[1000005];
int parei[1000005];
int outd[1000005];
int ind[1000005];
priority_queue<tuple<int, int, int> > toProc;
void setdir(int i, int j, int ei, int w) {
  ed[ei] = w;
  toProc.emplace(-dp[j], !w, j);
  if (dp[j] == dp[i] + 1) {
    detp[j] = w;
    for (auto e : aux[j]) {
      int nj, nei;
      tie(nj, nei) = e;
      setdir(i, nj, nei, w);
    }
  }
}
bool go1(int i, int pr, int dep) {
  sn[i] = true;
  dp[i] = dep;
  par[i] = pr;
  bool retVal = false;
  for (auto e : u[i]) {
    int j, ei;
    tie(j, ei) = e;
    if (j != pr) {
      if (!sn[j]) {
        cc[i] = j;
        parei[j] = ei;
        if (go1(j, i, dep + 1)) {
          retVal = true;
        }
      } else {
        if (dp[j] < dp[i]) {
          nxt[ei] = cc[j];
          aux[cc[j]].emplace_back(i, ei);
        } else {
        }
      }
    }
  }
  retVal |= i == t;
  return retVal;
}
bool go2(int i, int pr, int dep) {
  sn[i] = true;
  bool retVal = false;
  for (auto e : u[i]) {
    int j, ei;
    tie(j, ei) = e;
    if (j != pr) {
      if (!sn[j]) {
        if (go2(j, i, dep + 1)) {
          retVal = true;
          setdir(i, j, ei, 0);
        }
      }
    }
  }
  retVal |= i == t;
  return retVal;
}
int main() {
  memset(detp, -1, sizeof detp);
  memset(ed, -1, sizeof ed);
  int T;
  scanf("%d", &T);
  for (int Z = (0); Z < (T); Z++) {
    scanf("%d %d %d %d", &n, &m, &s, &t);
    s--;
    t--;
    for (int i = (0); i < (m); i++) {
      int x, y;
      scanf("%d %d", &x, &y);
      x--;
      y--;
      if (x > y) swap(x, y);
      el.emplace_back(x, y, i);
      u[x].emplace_back(y, i);
      u[y].emplace_back(x, i);
      if ((x == s && y == t) || (x == t && y == s)) {
        hasST = true;
      }
    }
    if (!hasST) {
      int x = s, y = t;
      if (x > y) swap(x, y);
      el.emplace_back(x, y, m);
      u[x].emplace_back(y, m);
      u[y].emplace_back(x, m);
    }
    go1(s, -1, 0);
    for (int i = (0); i < (n); i++) sn[i] = false;
    go2(s, -1, 0);
    while (int(toProc.size())) {
      auto f = toProc.top();
      toProc.pop();
      int _dpth, w, i;
      tie(_dpth, w, i) = f;
      while (detp[i] == -1) {
        setdir(par[i], i, parei[i], w);
        i = par[i];
      }
    }
    queue<int> q;
    for (int i = (0); i < (int(el.size())); i++) {
      int x, y, ei;
      tie(x, y, ei) = el[i];
      if (ed[ei] == -1) {
        printf("No\n");
        goto end;
      }
      if ((ed[ei] == 1) ^ (dp[x] < dp[y])) {
        chk[x].push_back(y);
        outd[x]++;
        ind[y]++;
      } else {
        chk[y].push_back(x);
        outd[y]++;
        ind[x]++;
      }
    }
    for (int i = (0); i < (n); i++) {
      if ((i == s && ind[i] != 0) || (i == t && outd[i] != 0) ||
          (i != s && i != t && (ind[i] == 0 || outd[i] == 0))) {
        printf("No\n");
        goto end;
      }
    }
    for (int i = (0); i < (n); i++) sn[i] = false;
    q.push(s);
    while (int(q.size())) {
      int i = q.front();
      q.pop();
      sn[i] = true;
      for (int j : chk[i]) {
        ind[j]--;
        if (ind[j] == 0) {
          q.push(j);
        }
      }
    }
    for (int i = (0); i < (n); i++) {
      if (!sn[i]) {
        printf("No\n");
        goto end;
      }
    }
    printf("Yes\n");
    for (int i = (0); i < (m); i++) {
      int x, y, ei;
      tie(x, y, ei) = el[i];
      if ((ed[ei] == 1) ^ (dp[x] < dp[y])) {
        printf("%d %d\n", x + 1, y + 1);
      } else {
        printf("%d %d\n", y + 1, x + 1);
      }
    }
  end:;
    el.clear();
    hasST = false;
    for (int i = (0); i < (n); i++) {
      u[i].clear();
      aux[i].clear();
      sn[i] = false;
      dp[i] = 0;
      nxt[i] = 0;
      cc[i] = 0;
      par[i] = 0;
      parei[i] = 0;
      ind[i] = 0;
      outd[i] = 0;
      detp[i] = -1;
      chk[i].clear();
    }
    for (int i = (0); i < (m + 1); i++) {
      ed[i] = -1;
    }
    n = m = s = t = 0;
  }
  return 0;
}

### Prompt

Construct a cpp code solution to the problem outlined:

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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, m, s, t;
vector<pair<int, int> > u[400005];
vector<tuple<int, int, int> > el;
vector<pair<int, int> > aux[400005];
bool hasST;
vector<int> chk[400005];
bool sn[1000005];
int dp[1000005];
int nxt[1000005];
int cc[1000005];
int ed[1000005];
int detp[1000005];
int par[1000005];
int parei[1000005];
int outd[1000005];
int ind[1000005];
priority_queue<tuple<int, int, int> > toProc;
void setdir(int i, int j, int ei, int w) {
  ed[ei] = w;
  toProc.emplace(-dp[j], !w, j);
  if (dp[j] == dp[i] + 1) {
    detp[j] = w;
    for (auto e : aux[j]) {
      int nj, nei;
      tie(nj, nei) = e;
      setdir(i, nj, nei, w);
    }
  }
}
bool go1(int i, int pr, int dep) {
  sn[i] = true;
  dp[i] = dep;
  par[i] = pr;
  bool retVal = false;
  for (auto e : u[i]) {
    int j, ei;
    tie(j, ei) = e;
    if (j != pr) {
      if (!sn[j]) {
        cc[i] = j;
        parei[j] = ei;
        if (go1(j, i, dep + 1)) {
          retVal = true;
        }
      } else {
        if (dp[j] < dp[i]) {
          nxt[ei] = cc[j];
          aux[cc[j]].emplace_back(i, ei);
        } else {
        }
      }
    }
  }
  retVal |= i == t;
  return retVal;
}
bool go2(int i, int pr, int dep) {
  sn[i] = true;
  bool retVal = false;
  for (auto e : u[i]) {
    int j, ei;
    tie(j, ei) = e;
    if (j != pr) {
      if (!sn[j]) {
        if (go2(j, i, dep + 1)) {
          retVal = true;
          setdir(i, j, ei, 0);
        }
      }
    }
  }
  retVal |= i == t;
  return retVal;
}
int main() {
  memset(detp, -1, sizeof detp);
  memset(ed, -1, sizeof ed);
  int T;
  scanf("%d", &T);
  for (int Z = (0); Z < (T); Z++) {
    scanf("%d %d %d %d", &n, &m, &s, &t);
    s--;
    t--;
    for (int i = (0); i < (m); i++) {
      int x, y;
      scanf("%d %d", &x, &y);
      x--;
      y--;
      if (x > y) swap(x, y);
      el.emplace_back(x, y, i);
      u[x].emplace_back(y, i);
      u[y].emplace_back(x, i);
      if ((x == s && y == t) || (x == t && y == s)) {
        hasST = true;
      }
    }
    if (!hasST) {
      int x = s, y = t;
      if (x > y) swap(x, y);
      el.emplace_back(x, y, m);
      u[x].emplace_back(y, m);
      u[y].emplace_back(x, m);
    }
    go1(s, -1, 0);
    for (int i = (0); i < (n); i++) sn[i] = false;
    go2(s, -1, 0);
    while (int(toProc.size())) {
      auto f = toProc.top();
      toProc.pop();
      int _dpth, w, i;
      tie(_dpth, w, i) = f;
      while (detp[i] == -1) {
        setdir(par[i], i, parei[i], w);
        i = par[i];
      }
    }
    queue<int> q;
    for (int i = (0); i < (int(el.size())); i++) {
      int x, y, ei;
      tie(x, y, ei) = el[i];
      if (ed[ei] == -1) {
        printf("No\n");
        goto end;
      }
      if ((ed[ei] == 1) ^ (dp[x] < dp[y])) {
        chk[x].push_back(y);
        outd[x]++;
        ind[y]++;
      } else {
        chk[y].push_back(x);
        outd[y]++;
        ind[x]++;
      }
    }
    for (int i = (0); i < (n); i++) {
      if ((i == s && ind[i] != 0) || (i == t && outd[i] != 0) ||
          (i != s && i != t && (ind[i] == 0 || outd[i] == 0))) {
        printf("No\n");
        goto end;
      }
    }
    for (int i = (0); i < (n); i++) sn[i] = false;
    q.push(s);
    while (int(q.size())) {
      int i = q.front();
      q.pop();
      sn[i] = true;
      for (int j : chk[i]) {
        ind[j]--;
        if (ind[j] == 0) {
          q.push(j);
        }
      }
    }
    for (int i = (0); i < (n); i++) {
      if (!sn[i]) {
        printf("No\n");
        goto end;
      }
    }
    printf("Yes\n");
    for (int i = (0); i < (m); i++) {
      int x, y, ei;
      tie(x, y, ei) = el[i];
      if ((ed[ei] == 1) ^ (dp[x] < dp[y])) {
        printf("%d %d\n", x + 1, y + 1);
      } else {
        printf("%d %d\n", y + 1, x + 1);
      }
    }
  end:;
    el.clear();
    hasST = false;
    for (int i = (0); i < (n); i++) {
      u[i].clear();
      aux[i].clear();
      sn[i] = false;
      dp[i] = 0;
      nxt[i] = 0;
      cc[i] = 0;
      par[i] = 0;
      parei[i] = 0;
      ind[i] = 0;
      outd[i] = 0;
      detp[i] = -1;
      chk[i].clear();
    }
    for (int i = (0); i < (m + 1); i++) {
      ed[i] = -1;
    }
    n = m = s = t = 0;
  }
  return 0;
}

```