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 node {
  int id;
  int roz;
  int pri;
  node *lew;
  node *pra;
  node *oj;
  node() {
    lew = NULL;
    pra = NULL;
    oj = NULL;
    roz = 1;
    pri = rand();
  }
  node(int idid) {
    id = idid;
    lew = NULL;
    pra = NULL;
    oj = NULL;
    roz = 1;
    pri = rand();
  }
  void update() {
    roz = 1;
    if (lew != NULL) roz += lew->roz;
    if (pra != NULL) roz += pra->roz;
  }
};
node *merge(node *v, node *u) {
  if (v == NULL) return u;
  if (u == NULL) return v;
  if ((v->pri) >= (u->pri)) {
    v->pra = merge(v->pra, u);
    if (v->pra != NULL) v->pra->oj = v;
    v->update();
    return v;
  } else {
    u->lew = merge(v, u->lew);
    if (u->lew != NULL) u->lew->oj = u;
    u->update();
    return u;
  }
}
pair<node *, node *> split(node *v, int chceroz) {
  if (v == NULL) return make_pair(v, v);
  v->oj = NULL;
  int nalew = 1;
  if (v->lew != NULL) nalew += v->lew->roz;
  if (nalew <= chceroz) {
    pair<node *, node *> ret = split(v->pra, chceroz - nalew);
    v->pra = ret.first;
    if (v->pra != NULL) v->pra->oj = v;
    v->update();
    ret.first = v;
    return ret;
  } else {
    pair<node *, node *> ret = split(v->lew, chceroz);
    v->lew = ret.second;
    if (v->lew != NULL) v->lew->oj = v;
    v->update();
    ret.second = v;
    return ret;
  }
}
int poznaj(node *v, int czytu) {
  int ret = 1;
  if (v->lew != NULL) ret += v->lew->roz;
  if (!czytu) ret = 0;
  if (v->oj == NULL) return ret;
  return ret + poznaj(v->oj, ((v->oj->pra) == v));
}
node *korz;
int t;
int n, m;
int ss, tt;
vector<int> graf[1000007];
int bylo[1000007];
int ojc[1000007];
int odl[1000007];
int juz[1000007];
vector<pair<int, pair<int, int> > > kan;
vector<int> pro;
int ostkol[1000007];
node *wsk[1000007];
void czys() {
  for (int i = 1; i <= n; i++) bylo[i] = 0;
}
void dfs1(int v, int oj) {
  bylo[v] = 1;
  for (int i = 0; i < graf[v].size(); i++) {
    if (graf[v][i] == oj) swap(graf[v][i], graf[v][0]);
  }
  for (int i = 0; i < graf[v].size(); i++)
    if (!bylo[graf[v][i]]) dfs1(graf[v][i], v);
}
void dfs2(int v) {
  bylo[v] = 1;
  for (int i = 0; i < graf[v].size(); i++) {
    if (graf[v][i] == ojc[v]) continue;
    if (!bylo[graf[v][i]]) {
      odl[graf[v][i]] = odl[v] + 1;
      ojc[graf[v][i]] = v;
      dfs2(graf[v][i]);
      continue;
    }
    if (odl[v] > odl[graf[v][i]])
      kan.push_back(make_pair(odl[graf[v][i]], make_pair(v, graf[v][i])));
  }
}
int stin[1000007];
int stout[1000007];
vector<int> ngraf[1000007];
int main() {
  srand(69);
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d%d%d", &n, &m, &ss, &tt);
    for (int i = 1; i <= n; i++) graf[i].clear();
    for (int i = 1; i <= n; i++) wsk[i] = NULL;
    for (int i = 1; i <= n; i++) juz[i] = 0;
    for (int i = 1; i <= m; i++) {
      int p1, p2;
      scanf("%d%d", &p1, &p2);
      graf[p1].push_back(p2);
      graf[p2].push_back(p1);
    }
    czys();
    dfs1(tt, 0);
    czys();
    odl[ss] = 1;
    kan.clear();
    ojc[ss] = 0;
    dfs2(ss);
    sort(kan.begin(), kan.end());
    pro.clear();
    int pom = tt;
    korz = NULL;
    while (pom) {
      wsk[pom] = new node(pom);
      korz = merge(wsk[pom], korz);
      juz[pom] = 1;
      pom = ojc[pom];
    }
    for (int i = 0; i < kan.size(); i++) {
      int x = kan[i].second.first;
      int y = kan[i].second.second;
      if (juz[x]) continue;
      vector<int> stos;
      int pom = x;
      int zjeb = 0;
      while (!juz[pom]) {
        if (pom == y) {
          zjeb = 1;
          break;
        }
        stos.push_back(pom);
        pom = ojc[pom];
      }
      if (pom == y) continue;
      if (zjeb) continue;
      int raz = poznaj(wsk[y], 1);
      int dwa = poznaj(wsk[pom], 1);
      if (raz > dwa) {
        swap(raz, dwa);
        swap(y, pom);
        reverse(stos.begin(), stos.end());
      }
      node *nowy = NULL;
      for (int j = 0; j < stos.size(); j++) {
        wsk[stos[j]] = new node(stos[j]);
        nowy = merge(nowy, wsk[stos[j]]);
        juz[stos[j]] = 1;
      }
      pair<node *, node *> bier = split(korz, raz);
      korz = merge(merge(bier.first, nowy), bier.second);
    }
    if (korz->roz != n) {
      printf("No\n");
      continue;
    }
    for (int i = 1; i <= n; i++) ostkol[i] = poznaj(wsk[i], 1);
    for (int i = 1; i <= n; i++) {
      stin[i] = 0;
      stout[i] = 0;
      ngraf[i].clear();
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j < graf[i].size(); j++) {
        if (ostkol[i] <= ostkol[graf[i][j]]) {
          ngraf[i].push_back(graf[i][j]);
          stout[i]++;
          stin[graf[i][j]]++;
        }
      }
    }
    int zjeb = 0;
    for (int i = 1; i <= n; i++) {
      if ((stout[i] == 0) != (i == tt)) zjeb = 1;
      if ((stin[i] == 0) != (i == ss)) zjeb = 1;
    }
    if (zjeb) {
      assert(0);
      printf("No\n");
      continue;
    }
    printf("Yes\n");
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j < graf[i].size(); j++) {
        if (ostkol[i] <= ostkol[graf[i][j]]) {
          printf("%d %d\n", i, graf[i][j]);
        }
      }
    }
  }
  return 0;
}