# include <bits/stdc++.h>
# define ll long long
# define fr first
# define se second
using namespace std;
vector<ll> v[200010];
ll used[200010] , pre[200010] , s , u , us[200010] , user[200010];
map<ll ,  bool> ma[200010];
vector<pair<ll , ll> > ans;
ll dfs(int x , int po){
    pre[x] = po;
    used[x] = 1;
   // cout<<x<< ' '<<po<<'\n';
    for(ll i = 0 ; i < v[x].size() ; i ++){
        ll to = v[x][i];
        if(used[to] == 0 && s != to && u != to)
            dfs(to , po) , ans.push_back({x , to});
    }
}
int main()
{
    ll n , i , x , y , st , ut , m;
    cin>> n>> m;
    for(i = 1 ; i <= m ; i ++){
        cin>> x>> y;
        v[x].push_back(y);
        v[y].push_back(x);
    ma[y][x] = 1;
    ma[x][y] = 1;
    }
    for(i = 1 ; i <= n ; i ++) pre[i] = i;
    cin>> s>> u>> st>> ut;
    for(i = 1 ; i <= n ; i ++){
        if(used[i] == 0 && i != s && i != u){
            dfs(i , i);
        }
    }

    ll tol1 = 0 , tol2 = 0;
    for(i = 0 ; i < v[s].size() ; i ++){
        ll to = v[s][i];
        to = pre[to];
        us[to] = v[s][i];
    }
    for(i = 0 ; i < v[u].size() ; i ++){
        ll to = v[u][i];
        to = pre[to];
        if(us[to] != 0){
            tol1 = us[to] , tol2 = v[u][i];
        }
    }
    if(tol1 == 0 && ma[s][u] == 0){cout<<"No";return 0;}
     pre[pre[tol1]] =  s;
    ans.push_back({s , tol1});
    ans.push_back({u , tol2});
        if(ma[s][u] == 1 && tol1 == 0)
        ans.push_back({s , u});
    ll lol1 = 1 , lol2 = 1;
    ///----------------------------------
    for(i = 0 ; i < v[s].size() ; i ++){
        ll to = v[s][i];
        to = pre[to];
        to = pre[to];
        if(to == u || to == s) continue ;
        user[to] = 1;
    }
    for(i = 0 ; i < v[u].size() ; i ++){
        ll to = v[u][i];
        to = pre[to];
        to = pre[to];
        if(to == s || to == u) continue ;
        if(user[to] == 1) user[to] = 2;
    }
    ///-----------------------------------
    pre[s] = s , pre[u] = u;
    for(i = 0 ; i < v[s].size() ; i ++){
        ll to = v[s][i];
       // cout<<i<<' '<<to<<'\n';
        to = pre[to];
        to = pre[to];
        if(to == u || to == s) continue ;
        if(user[to] != 2) lol1++ , ans.push_back({s , v[s][i]}) , pre[to] = s;
    }
    for(i = 0 ; i < v[u].size() ; i ++){
        ll to = v[u][i];
      //  cout<<u<<' '<<to<<' ';
        to = pre[to];
        to = pre[to];
      //  cout<<to<<' '<<pre[to]<<'\n';
        if(to == s || to == u) continue ;
        if(user[to] != 2) lol2++ , ans.push_back({u , v[u][i]})  , pre[to] = u;
    }
    ll koli  = 0;
    for(i = 1 ; i <= n ; i ++)
        if(user[i] == 2) koli++;
    if(lol1 > st || lol2 > ut){cout<<"No";return 0;}
    if(st + ut < koli + lol1 + lol2){cout<<"No";return 0;}
    cout<<"Yes\n";
    for(i = 1 ; i <= n ; i ++){
        if(user[i] == 2 && lol1 < st) lol1 ++ , cout<<s<<' '<<i<<'\n';
        if(user[i] == 2) lol2 ++ , cout<<u<<' '<<i<<'\n';
    }
    for(i = 0 ; i < ans.size() ; i ++) cout<< ans[i].fr<<' '<<ans[i].se<<'\n';

}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf print
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 2000000000000000000
#define mod 1000000007
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
random_device rd;
mt19937 random(rd());*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 320003
ll f[ma],siz[ma],in[ma],a[ma],b[ma];

ll fin(ll u)
{
    if(f[u]==u)return f[u];
    return f[u]=fin(f[u]);
}

void unio(ll x,ll y)
{
    if(siz[x]<siz[y])swap(x,y);
    siz[x]+=siz[y];
    f[y]=x;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n,i,j,u,v,tc,m;
    while(cin>>n>>m)
    {
        for(i=1;i<m;i++)
        {
            cin>>a[i]>>b[i];
        }
        ll s,ds,t,dt;
        cin>>s>>t>>ds>>dt;
        vector<pair<ll,ll> > v;
        for(i=1;i<m;i++)
        {
            ll c=(a[i]==s)||(b[i]==s);
            c+=(a[i]==t)||(b[i]==t);
            v.pb(mk(c,i));
        }
        sort(v.begin(),v.end());
        for(i=1;i<=n;i++)
        {
            f[i]=i;
            siz[i]=1;
        }

        vector<pair<ll,ll> >v1;

        for(auto p:v)
        {
            ll x=a[p.ss];
            ll y=b[p.ss];
            ll x1=fin(x);
            ll y1=fin(y);
            if(x1==y1)continue;
            unio(x1,y1);
            in[x]++;in[y]++;
            v1.pb(mk(x,y));
        }

        if(in[s]>ds||in[t]>dt)
        {
            cout<<"NO"<<endl;
            continue;
        }

        cout<<"YES"<<endl;
        for(auto p:v1)cout<<p.ff<<" "<<p.ss<<endl;

    }
    return 0;
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf print
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 2000000000000000000
#define mod 1000000007
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
random_device rd;
mt19937 random(rd());*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 400004
ll f[ma],siz[ma],in[ma],a[ma],b[ma];
ll mark[ma],mark1[ma];
ll fin(ll u)
{
    if(f[u]==u)return f[u];
    return f[u]=fin(f[u]);
}

void unio(ll x,ll y)
{
    if(siz[x]<siz[y])swap(x,y);
    siz[x]+=siz[y];
    f[y]=x;
}

vector<ll>adj[ma];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n,i,j,u,v,tc,m;
    while(cin>>n>>m)
    {
        for(i=1;i<=m;i++)
        {
            cin>>a[i]>>b[i];
            adj[a[i]].pb(b[i]);
            adj[b[i]].pb(a[i]);
        }
        ll s,ds,t,dt;
        cin>>s>>t>>ds>>dt;
        vector<pair<ll,ll> > v;
        for(i=1;i<=m;i++)
        {
            ll c=(a[i]==s)||(b[i]==s);
            c+=(a[i]==t)||(b[i]==t);
            v.pb(mk(c,i));
        }
        sort(v.begin(),v.end());
        for(i=1;i<=n;i++)
        {
            f[i]=i;
            siz[i]=1;
        }
        vector<pair<ll,ll> >v1;
        for(auto p:v)
        {
            ll x=a[p.ss];
            ll y=b[p.ss];
            ll x1=fin(x);
            ll y1=fin(y);
            if(x1==y1)continue;
            if(p.ff)continue;
            unio(x1,y1);
            v1.pb(mk(x,y));
            in[x]++;in[y]++;
        }

        for(i=1;i<=m;i++)
        {
            if(a[i]==s&&b[i]==t)continue;
            if(a[i]==t&&b[i]==s)continue;
            if(a[i]==s||b[i]==s)
            {
                if(a[i]!=s)mark[fin(a[i])]=1;
                else mark[fin(b[i])]=1;
            }
            if(a[i]==t||b[i]==t)
            {
                if(a[i]!=t)mark1[fin(a[i])]=1;
                else mark1[fin(b[i])]=1;
            }
        }

        for(i=1;i<=m;i++)
        {
            if(a[i]==s&&b[i]==t)continue;
            if(a[i]==t&&b[i]==s)continue;
            if(b[i]==s||b[i]==t)swap(a[i],b[i]);
            ll p=fin(b[i]);
            if(mark[p]==1&&mark1[p]==1)continue;
            ll q=fin(a[i]);
            if(p==q)continue;
            unio(p,q);
            v1.pb({a[i],b[i]});
            in[a[i]]++;
        }

        if(in[s]>ds||in[t]>dt)
        {
            cout<<"No"<<endl;
            continue;
        }
        for(auto p:v)
        {
            ll x=a[p.ss];
            ll y=b[p.ss];
            ll x1=fin(x);
            ll y1=fin(y);
           // cout<<x<<" "<<y<<" "<<x1<<" "<<y1<<endl;
            if(x1==y1)continue;
            if((x==s||y==s)&&in[s]==ds)continue;
            if((x==t||y==t)&&in[t]==dt)continue;
           // cout<<x1<<" "<<y1<<endl;
            unio(x1,y1);
            v1.pb({x,y});
        }

        if(v1.sz<n-1)
        {
            cout<<"No"<<endl;
            continue;
        }

        cout<<"Yes"<<endl;
        for(auto p:v1)cout<<p.ff<<" "<<p.ss<<endl;

    }
    return 0;
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf print
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 2000000000000000000
#define mod 1000000007
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
random_device rd;
mt19937 random(rd());*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 320003
ll f[ma],siz[ma],in[ma],a[ma],b[ma];

ll fin(ll u)
{
    if(f[u]==u)return f[u];
    return f[u]=fin(f[u]);
}

void unio(ll x,ll y)
{
    if(siz[x]<siz[y])swap(x,y);
    siz[x]+=siz[y];
    f[y]=x;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n,i,j,u,v,tc,m;
    while(cin>>n>>m)
    {
        for(i=1;i<=m;i++)
        {
            cin>>a[i]>>b[i];
        }
        ll s,ds,t,dt;
        cin>>s>>t>>ds>>dt;
        vector<pair<ll,ll> > v;
        for(i=1;i<=m;i++)
        {
            ll c=(a[i]==s)||(b[i]==s);
            c+=(a[i]==t)||(b[i]==t);
            v.pb(mk(c,i));
        }
        sort(v.begin(),v.end());
        for(i=1;i<=n;i++)
        {
            f[i]=i;
            siz[i]=1;
        }

        vector<pair<ll,ll> >v1;

        for(auto p:v)
        {
            ll x=a[p.ss];
            ll y=b[p.ss];
            ll x1=fin(x);
            ll y1=fin(y);
            if(x1==y1)continue;
            unio(x1,y1);
            in[x]++;in[y]++;
            v1.pb(mk(x,y));
        }

        if(in[s]>ds||in[t]>dt)
        {
            cout<<"No"<<endl;
            continue;
        }

        cout<<"Yes"<<endl;
        for(auto p:v1)cout<<p.ff<<" "<<p.ss<<endl;

    }
    return 0;
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf print
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 2000000000000000000
#define mod 1000000007
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
random_device rd;
mt19937 random(rd());*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 320003
ll f[ma],siz[ma],in[ma],a[ma],b[ma];

ll fin(ll u)
{
    if(f[u]==u)return f[u];
    return f[u]=fin(f[u]);
}

void unio(ll x,ll y)
{
    if(siz[x]<siz[y])swap(x,y);
    siz[x]+=siz[y];
    f[y]=x;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n,i,j,u,v,tc,m;
    while(cin>>n>>m)
    {
        for(i=1;i<m;i++)
        {
            cin>>a[i]>>b[i];
        }
        ll s,ds,t,dt;
        cin>>s>>t>>ds>>dt;
        vector<pair<ll,ll> > v;
        for(i=1;i<m;i++)
        {
            ll c=(a[i]==s)||(b[i]==s);
            c+=(a[i]==t)||(b[i]==t);
            v.pb(mk(c,i));
        }
        sort(v.begin(),v.end());
        for(i=1;i<=n;i++)
        {
            f[i]=i;
            siz[i]=1;
        }

        vector<pair<ll,ll> >v1;

        for(auto p:v)
        {
            ll x=a[p.ss];
            ll y=b[p.ss];
            ll x1=fin(x);
            ll y1=fin(y);
            if(x1==y1)continue;
            unio(x1,y1);
            in[x]++;in[y]++;
            v1.pb(mk(x,y));
        }

        if(in[s]>ds||in[t]>dt)
        {
            cout<<"No"<<endl;
            continue;
        }

        cout<<"Yes"<<endl;
        for(auto p:v1)cout<<p.ff<<" "<<p.ss<<endl;

    }
    return 0;
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf print
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 2000000000000000000
#define mod 1000000007
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
random_device rd;
mt19937 random(rd());*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 400004
ll f[ma],siz[ma],in[ma],a[ma],b[ma];

ll fin(ll u)
{
    if(f[u]==u)return f[u];
    return f[u]=fin(f[u]);
}

void unio(ll x,ll y)
{
    if(siz[x]<siz[y])swap(x,y);
    siz[x]+=siz[y];
    f[y]=x;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n,i,j,u,v,tc,m;
    while(cin>>n>>m)
    {
        for(i=1;i<=m;i++)
        {
            cin>>a[i]>>b[i];
        }
        ll s,ds,t,dt;
        cin>>s>>t>>ds>>dt;
        vector<pair<ll,ll> > v;
        for(i=1;i<=m;i++)
        {
            ll c=(a[i]==s)||(b[i]==s);
            c+=(a[i]==t)||(b[i]==t);
            v.pb(mk(c,i));
        }
        sort(v.begin(),v.end());
        for(i=1;i<=n;i++)
        {
            f[i]=i;
            siz[i]=1;
        }
        vector<pair<ll,ll> >v1;
        for(auto p:v)
        {
            ll x=a[p.ss];
            ll y=b[p.ss];
            ll x1=fin(x);
            ll y1=fin(y);
            if(x1==y1)continue;
            unio(x1,y1);
            v1.pb(mk(x,y));
            in[x]++;in[y]++;
        }
        if(in[s]>ds||in[t]>dt||v1.sz<n-1)
        {
            cout<<"No"<<endl;
            continue;
        }
        cout<<"Yes"<<endl;
        for(auto p:v1)cout<<p.ff<<" "<<p.ss<<endl;

    }
    return 0;
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf print
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 2000000000000000000
#define mod 1000000007
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
random_device rd;
mt19937 random(rd());*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 400004
ll f[ma],siz[ma],in[ma],a[ma],b[ma];

ll fin(ll u)
{
    if(f[u]==u)return f[u];
    return f[u]=fin(f[u]);
}

void unio(ll x,ll y)
{
    if(siz[x]<siz[y])swap(x,y);
    siz[x]+=siz[y];
    f[y]=x;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n,i,j,u,v,tc,m;
    while(cin>>n>>m)
    {
        for(i=1;i<=m;i++)
        {
            cin>>a[i]>>b[i];
        }
        ll s,ds,t,dt;
        cin>>s>>t>>ds>>dt;
        vector<pair<ll,ll> > v;
        for(i=1;i<=m;i++)
        {
            ll c=(a[i]==s)||(b[i]==s);
            c+=(a[i]==t)||(b[i]==t);
            v.pb(mk(c,i));
        }
        sort(v.begin(),v.end());
        for(i=1;i<=n;i++)
        {
            f[i]=i;
            siz[i]=1;
        }
        vector<pair<ll,ll> >v1;
        for(auto p:v)
        {
            ll x=a[p.ss];
            ll y=b[p.ss];
            ll x1=fin(x);
            ll y1=fin(y);
            if(x1==y1)continue;
            unio(x1,y1);
            v1.pb(mk(x,y));
        }
        if(in[s]>ds||in[t]>dt||v1.sz<n-1)
        {
            cout<<"No"<<endl;
            continue;
        }
        cout<<"Yes"<<endl;
        for(auto p:v1)cout<<p.ff<<" "<<p.ss<<endl;

    }
    return 0;
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf print
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 2000000000000000000
#define mod 1000000007
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
random_device rd;
mt19937 random(rd());*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 400004
ll f[ma],siz[ma],in[ma],a[ma],b[ma];
ll mark[ma],mark1[ma];
ll fin(ll u)
{
    if(f[u]==u)return f[u];
    return f[u]=fin(f[u]);
}

void unio(ll x,ll y)
{
    if(siz[x]<siz[y])swap(x,y);
    siz[x]+=siz[y];
    f[y]=x;
}

vector<ll>adj[ma];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n,i,j,u,v,tc,m;
    while(cin>>n>>m)
    {
        for(i=1;i<=m;i++)
        {
            cin>>a[i]>>b[i];
            adj[a[i]].pb(b[i]);
            adj[b[i]].pb(a[i]);
        }
        ll s,ds,t,dt;
        cin>>s>>t>>ds>>dt;
        vector<pair<ll,ll> > v;
        for(i=1;i<=m;i++)
        {
            ll c=(a[i]==s)||(b[i]==s);
            c+=(a[i]==t)||(b[i]==t);
            v.pb(mk(c,i));
        }
        sort(v.begin(),v.end());
        for(i=1;i<=n;i++)
        {
            f[i]=i;
            siz[i]=1;
        }
        vector<pair<ll,ll> >v1;
        for(auto p:v)
        {
            ll x=a[p.ss];
            ll y=b[p.ss];
            ll x1=fin(x);
            ll y1=fin(y);
            if(x1==y1)continue;
            if(p.ff)continue;
            unio(x1,y1);
            v1.pb(mk(x,y));
            in[x]++;in[y]++;
        }

        for(i=1;i<=m;i++)
        {
            if(a[i]==s&&b[i]==t)continue;
            if(a[i]==t&&b[i]==s)continue;
            if(a[i]==s||b[i]==s)
            {
                if(a[i]!=s)mark[fin(a[i])]=1;
                else mark[fin(b[i])]=1;
            }
            if(a[i]==t||b[i]==t)
            {
                if(a[i]!=t)mark1[fin(a[i])]=1;
                else mark1[fin(b[i])]=1;
            }
        }

        for(i=1;i<=m;i++)
        {
            if(a[i]==s&&b[i]==t)continue;
            if(a[i]==t&&b[i]==s)continue;
            if(b[i]==s||b[i]==t)swap(a[i],b[i]);
            ll p=fin(b[i]);
            if(mark[p]==1&&mark1[p]==1)continue;
            ll q=fin(a[i]);
            if(p==q)continue;
            unio(p,q);
            v1.pb({a[i],b[i]});
            in[a[i]]++;
            in[b[i]]++;
        }

        if(in[s]>ds||in[t]>dt)
        {
            cout<<"No"<<endl;
            continue;
        }
        for(auto p:v)
        {
            ll x=a[p.ss];
            ll y=b[p.ss];
            ll x1=fin(x);
            ll y1=fin(y);
           // cout<<x<<" "<<y<<" "<<x1<<" "<<y1<<endl;
            if(x1==y1)continue;
            if((x==s||y==s)&&in[s]==ds)continue;
            if((x==t||y==t)&&in[t]==dt)continue;
           // cout<<x1<<" "<<y1<<endl;
            unio(x1,y1);
            v1.pb({x,y});
            in[x]++;in[y]++;
        }

        if(v1.sz<n-1)
        {
            cout<<"No"<<endl;
            continue;
        }

        cout<<"Yes"<<endl;
        for(auto p:v1)cout<<p.ff<<" "<<p.ss<<endl;

    }
    return 0;
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf print
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 2000000000000000000
#define mod 1000000007
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
random_device rd;
mt19937 random(rd());*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 320003
ll f[ma],siz[ma],in[ma],a[400004],b[400004];

ll fin(ll u)
{
    if(f[u]==u)return f[u];
    return f[u]=fin(f[u]);
}

void unio(ll x,ll y)
{
    if(siz[x]<siz[y])swap(x,y);
    siz[x]+=siz[y];
    f[y]=x;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n,i,j,u,v,tc,m;
    while(cin>>n>>m)
    {
        for(i=1;i<=m;i++)
        {
            cin>>a[i]>>b[i];
        }
        ll s,ds,t,dt;
        cin>>s>>t>>ds>>dt;
        vector<pair<ll,ll> > v;
        for(i=1;i<=m;i++)
        {
            ll c=(a[i]==s)||(b[i]==s);
            c+=(a[i]==t)||(b[i]==t);
            v.pb(mk(c,i));
        }
        sort(v.begin(),v.end());
        for(i=1;i<=n;i++)
        {
            f[i]=i;
            siz[i]=1;
        }

        vector<pair<ll,ll> >v1;

        for(auto p:v)
        {
            ll x=a[p.ss];
            ll y=b[p.ss];
            ll x1=fin(x);
            ll y1=fin(y);
            if(x1==y1)continue;
            unio(x1,y1);
            in[x]++;in[y]++;
            v1.pb(mk(x,y));
        }

        if(in[s]>ds||in[t]>dt)
        {
            cout<<"No"<<endl;
            continue;
        }

        cout<<"Yes"<<endl;
        for(auto p:v1)cout<<p.ff<<" "<<p.ss<<endl;

    }
    return 0;
}


#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf print
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 2000000000000000000
#define mod 1000000007
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
random_device rd;
mt19937 random(rd());*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 400004
ll f[ma],siz[ma],in[ma],a[ma],b[ma];
ll mark[ma],mark1[ma];
ll fin(ll u)
{
    if(f[u]==u)return f[u];
    return f[u]=fin(f[u]);
}

void unio(ll x,ll y)
{
    if(siz[x]<siz[y])swap(x,y);
    siz[x]+=siz[y];
    f[y]=x;
}

vector<ll>adj[ma];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n,i,j,u,v,tc,m;
    while(cin>>n>>m)
    {
        for(i=1;i<=m;i++)
        {
            cin>>a[i]>>b[i];
            adj[a[i]].pb(b[i]);
            adj[b[i]].pb(a[i]);
        }
        ll s,ds,t,dt;
        cin>>s>>t>>ds>>dt;
        vector<pair<ll,ll> > v;
        for(i=1;i<=m;i++)
        {
            ll c=(a[i]==s)||(b[i]==s);
            c+=(a[i]==t)||(b[i]==t);
            v.pb(mk(c,i));
        }
        sort(v.begin(),v.end());
        for(i=1;i<=n;i++)
        {
            f[i]=i;
            siz[i]=1;
        }
        vector<pair<ll,ll> >v1;
        for(auto p:v)
        {
            ll x=a[p.ss];
            ll y=b[p.ss];
            ll x1=fin(x);
            ll y1=fin(y);
            if(x1==y1)continue;
            if(p.ff)continue;
            unio(x1,y1);
            v1.pb(mk(x,y));
            in[x]++;in[y]++;
        }

        for(i=1;i<=m;i++)
        {
            if(a[i]==s&&b[i]==t)continue;
            if(a[i]==t&&b[i]==s)continue;
            if(a[i]==s||b[i]==s)
            {
                if(a[i]!=s)mark[fin(a[i])]=1;
                else mark[fin(b[i])]=1;
            }
            if(a[i]==t||b[i]==t)
            {
                if(a[i]!=t)mark1[fin(a[i])]=1;
                else mark1[fin(b[i])]=1;
            }
        }

        for(i=1;i<=m;i++)
        {
            if(a[i]==s&&b[i]==t)continue;
            if(a[i]==t&&b[i]==s)continue;
            if(b[i]==s||b[i]==t)swap(a[i],b[i]);
            ll p=fin(b[i]);
            if(mark[p]==1&&mark1[p]==1)continue;
            ll q=fin(a[i]);
            if(p==q)continue;
            unio(p,q);
            v1.pb({a[i],b[i]});
            in[a[i]]++;
        }

        if(in[s]>ds||in[t]>dt)
        {
            cout<<"do"<<endl;
            continue;
        }
        for(auto p:v)
        {
            ll x=a[p.ss];
            ll y=b[p.ss];
            ll x1=fin(x);
            ll y1=fin(y);
           // cout<<x<<" "<<y<<" "<<x1<<" "<<y1<<endl;
            if(x1==y1)continue;
            if((x==s||y==s)&&in[s]==ds)continue;
            if((x==t||y==t)&&in[t]==dt)continue;
            cout<<x1<<" "<<y1<<endl;
            unio(x1,y1);
            v1.pb({x,y});
        }

        if(v1.sz<n-1)
        {
            cout<<"No"<<endl;
            continue;
        }

        cout<<"Yes"<<endl;
        for(auto p:v1)cout<<p.ff<<" "<<p.ss<<endl;

    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <memory.h>
#include <string>
#include <string.h>
#include <map>
using namespace std;
int n,m;
const int N = 200001;
int parent[N];
vector<pair<int, int> >sol;
vector<pair<int, int> >edge;
int d1, d2, n1, n2;
int find(int x) {
	if (x == parent[x])
		return x;
	return parent[x] = find(parent[x]);
}
struct Edge {
	int a, b, cost;
	Edge(int _a, int _b, int _cost) {
		a = _a;
		b = _b;
		cost = _cost;
	}
	Edge(){}
	bool operator<(Edge const &r)const {
		return (cost < r.cost);
	}
};
Edge sortE[400001];
vector<vector<int> >v;
int main() {
#ifndef ONLINE_JUDGE
	freopen("output.txt", "r", stdin);
#endif // !ONLINE_JUDGE
	scanf("%d%d", &n,&m);
	for (int i = 1; i <= n; ++i)
		parent[i] = i;
	v.resize(n + 1);
	for (int i = 0, a, b; i < m; ++i) {
		scanf("%d%d", &a, &b);
		edge.push_back(make_pair(a, b));
		v[a].push_back(b);
		v[b].push_back(a);
	}
	scanf("%d%d%d%d", &d1, &d2, &n1, &n2);
	for (int i = 0; i < edge.size(); ++i) {
		int a = edge[i].first, b = edge[i].second,cc=0;
		if ((a == d1 && b == d2) || (a == d2 && b == d1))
			cc = 2;
		else if (a == d1 || a == d2 || b == d1 || b == d2)
			cc = 1;
		cc += min(v[a].size(), v[b].size());
		Edge tmp(a, b, cc);
		sortE[i] = tmp;
	}
	sort(sortE, sortE+m);
	for (int i = 0; i < m; ++i) {
		int a = sortE[i].a;
		int b = sortE[i].b;
		int roota = find(a);
		int rootb = find(b);
		if (roota != rootb) {
			if ((a == d1 && b == d2) || (a == d2 && b == d1)) {
				if (n1 >= 1 && n2 >= 1) {
					n1--;
					n2--;
				}
				else
					continue;
			}
			else {
				if ((a == d1 || b == d1))
					if (n1 >= 1)
						n1--;
					else
						continue;
				else if((a==d2 || b==d2))
					if (n2 >= 1)
						n2--;
					else
						continue;

			}
			sol.push_back(make_pair(a, b));
			parent[roota] = rootb;
		}

	}
	if (sol.size() == n - 1) {
		cout << "Yes" << endl;
		for (int i = 0; i < sol.size(); ++i) {
			printf("%d %d\n", sol[i].first, sol[i].second);
		}
	}
	else
		cout << "No" << endl;

}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <memory.h>
#include <string>
#include <string.h>
#include <map>
using namespace std;
int n,m;
const int N = 200001;
int parent[N];
vector<pair<int, int> >sol;
vector<vector<int> >v;
pair<int, int> cost[2];
int find(int x) {
	if (x == parent[x])
		return x;
	return parent[x] = find(parent[x]);
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("output.txt", "r", stdin);
#endif // !ONLINE_JUDGE
	scanf("%d%d", &n,&m);
	for (int i = 1; i <= n; ++i)
		parent[i] = i;
	v.resize(n + 1);
	for (int i = 0, a, b; i < m; ++i) {
		scanf("%d%d", &a, &b);
		v[a].push_back(b);
		v[b].push_back(a);
	}
	scanf("%d%d%d%d", &cost[0].first, &cost[1].first, &cost[0].second, &cost[0].second);
	int edges = 0;
	for (int i = 1; i < v.size(); ++i) {
		bool ans = true;
		for (int j = 0; j < 2; ++j) {
			if (i == cost[j].first)
				ans = false;
		}
		if (!ans)
			continue;
		for (int k = 0; k < v[i].size(); ++k) {
			int d = v[i][k];
			int roota = find(d);
			int rootb = find(i);
			if (roota != rootb) {
				for(int j=0;j<2;++j)
					if (d == cost[j].first && cost[j].second - 1 >= 0) {
						cost[j].second--;
					}
					else if(d == cost[j].first)
						continue;
				sol.push_back(make_pair(i, d));
				parent[roota] = rootb;
				edges++;
			}
		}
	}
	for (int i = 0; i < v[cost[0].first].size(); ++i) {
		int d = v[cost[0].first][i];
		if (d == cost[1].first && find(d) != find(cost[0].first)) {
			if (cost[0].second >= 1 && cost[1].second >= 1)
			{
				sol.push_back(make_pair(cost[0].first, cost[1].first));
				edges++;
			}
		}
	}
	if (edges == n - 1) {
		cout << "Yes" << endl;
		for (int i = 0; i < sol.size(); ++i) {
			printf("%d %d\n", sol[i].first, sol[i].second);
		}
	}
	else
		cout << "No" << endl;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <memory.h>
#include <string>
#include <string.h>
#include <map>
using namespace std;
int n,m;
const int N = 1001;
int parent[N];
vector<pair<int, int> >sol;
vector<int>v;
vector<pair<int, int> >edge;
int d1, d2, n1, n2;
int find(int x) {
	if (x == parent[x])
		return x;
	return parent[x] = find(parent[x]);
}
struct Edge {
	int a, b, cost;
	Edge(int _a, int _b, int _cost) {
		a = _a;
		b = _b;
		cost = _cost;
	}
	Edge(){}
	bool operator<(Edge const &r)const {
		return (cost < r.cost);
	}
};
Edge sortE[200000];

int main() {
#ifndef ONLINE_JUDGE
	freopen("output.txt", "r", stdin);
#endif // !ONLINE_JUDGE
	scanf("%d%d", &n,&m);
	for (int i = 1; i <= n; ++i)
		parent[i] = i;
	for (int i = 0, a, b; i < m; ++i) {
		scanf("%d%d", &a, &b);
		edge.push_back(make_pair(a, b));
	}
	scanf("%d%d%d%d", &d1, &d2, &n1, &n2);
	for (int i = 0; i < edge.size(); ++i) {
		int a = edge[i].first, b = edge[i].second,cc=0;
		if ((a == d1 && b == d2) || (a == d2 && b == d1))
			cc = 2;
		else if (a == d1 || a == d2 || b == d1 || b == d2)
			cc = 1;
		Edge tmp(a, b, cc);
		sortE[i] = tmp;
	}
	sort(sortE, sortE+m);
	for (int i = 0; i < m; ++i) {
		int a = sortE[i].a;
		int b = sortE[i].b;
		int roota = find(a);
		int rootb = find(b);
		if (roota != rootb) {
			if ((a == d1 && b == d2) || (a == d2 && b == d1)) {
				if (n1 >= 1 && n2 >= 1) {
					n1--;
					n2--;
				}
				else
					continue;
			}
			else {
				if ((a == d1 || b == d1))
					if (n1 >= 1)
						n1--;
					else
						continue;
				else if((a==d2 || b==d2))
					if (n2 >= 1)
						n2--;
					else
						continue;

			}
			sol.push_back(make_pair(a, b));
			parent[roota] = rootb;
		}

	}
	if (sol.size() == n - 1) {
		cout << "Yes" << endl;
		for (int i = 0; i < sol.size(); ++i) {
			printf("%d %d\n", sol[i].first, sol[i].second);
		}
	}
	else
		cout << "No" << endl;

}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <memory.h>
#include <string>
#include <string.h>
#include <map>
using namespace std;
int n,m;
const int N = 200001;
int parent[N];
vector<pair<int, int> >sol;
vector<int>v;
vector<pair<int, int> >edge;
int d1, d2, n1, n2;
int find(int x) {
	if (x == parent[x])
		return x;
	return parent[x] = find(parent[x]);
}
struct Edge {
	int a, b, cost;
	Edge(int _a, int _b, int _cost) {
		a = _a;
		b = _b;
		cost = _cost;
	}
	Edge(){}
	bool operator<(Edge const &r)const {
		return (cost < r.cost);
	}
};
Edge sortE[400001];

int main() {
#ifndef ONLINE_JUDGE
	freopen("output.txt", "r", stdin);
#endif // !ONLINE_JUDGE
	scanf("%d%d", &n,&m);
	for (int i = 1; i <= n; ++i)
		parent[i] = i;
	for (int i = 0, a, b; i < m; ++i) {
		scanf("%d%d", &a, &b);
		edge.push_back(make_pair(a, b));
	}
	scanf("%d%d%d%d", &d1, &d2, &n1, &n2);
	for (int i = 0; i < edge.size(); ++i) {
		int a = edge[i].first, b = edge[i].second,cc=0;
		if ((a == d1 && b == d2) || (a == d2 && b == d1))
			cc = 2;
		else if (a == d1 || a == d2 || b == d1 || b == d2)
			cc = 1;
		Edge tmp(a, b, cc);
		sortE[i] = tmp;
	}
	sort(sortE, sortE+m);
	for (int i = 0; i < m; ++i) {
		int a = sortE[i].a;
		int b = sortE[i].b;
		int roota = find(a);
		int rootb = find(b);
		if (roota != rootb) {
			if ((a == d1 && b == d2) || (a == d2 && b == d1)) {
				if (n1 >= 1 && n2 >= 1) {
					n1--;
					n2--;
				}
				else
					continue;
			}
			else {
				if ((a == d1 || b == d1))
					if (n1 >= 1)
						n1--;
					else
						continue;
				else if((a==d2 || b==d2))
					if (n2 >= 1)
						n2--;
					else
						continue;

			}
			sol.push_back(make_pair(a, b));
			parent[roota] = rootb;
		}

	}
	if (sol.size() == n - 1) {
		cout << "Yes" << endl;
		for (int i = 0; i < sol.size(); ++i) {
			printf("%d %d\n", sol[i].first, sol[i].second);
		}
	}
	else
		cout << "No" << endl;

}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <memory.h>
#include <string>
#include <string.h>
#include <map>
using namespace std;
int n,m;
const int N = 200001;
int parent[N];
vector<pair<int, int> >sol;
vector<pair<int, int> >edge;
int d1, d2, n1, n2;
int find(int x) {
	if (x == parent[x])
		return x;
	return parent[x] = find(parent[x]);
}
struct Edge {
	int a, b, cost;
	Edge(int _a, int _b, int _cost) {
		a = _a;
		b = _b;
		cost = _cost;
	}
	Edge(){}
	bool operator<(Edge const &r)const {
		return (cost < r.cost);
	}
};
Edge sortE[400001];
vector<vector<int> >v;
int main() {
#ifndef ONLINE_JUDGE
	freopen("output.txt", "r", stdin);
#endif // !ONLINE_JUDGE
	scanf("%d%d", &n,&m);
	for (int i = 1; i <= n; ++i)
		parent[i] = i;
	v.resize(n + 1);
	for (int i = 0, a, b; i < m; ++i) {
		scanf("%d%d", &a, &b);
		edge.push_back(make_pair(a, b));
		v[a].push_back(b);
		v[b].push_back(a);
	}
	scanf("%d%d%d%d", &d1, &d2, &n1, &n2);
	for (int i = 0; i < edge.size(); ++i) {
		int a = edge[i].first, b = edge[i].second,cc=0;
		if ((a == d1 && b == d2) || (a == d2 && b == d1))
			cc = 500001;
		else if (a == d1 || a == d2 || b == d1 || b == d2)
			cc = 400001;
		cc += min(v[a].size(), v[b].size());
		Edge tmp(a, b, cc);
		sortE[i] = tmp;
	}
	sort(sortE, sortE+m);
	for (int i = 0; i < m; ++i) {
		int a = sortE[i].a;
		int b = sortE[i].b;
		int roota = find(a);
		int rootb = find(b);
		if (roota != rootb) {
			if ((a == d1 && b == d2) || (a == d2 && b == d1)) {
				if (n1 >= 1 && n2 >= 1) {
					n1--;
					n2--;
				}
				else
					continue;
			}
			else {
				if ((a == d1 || b == d1))
					if (n1 >= 1)
						n1--;
					else
						continue;
				else if((a==d2 || b==d2))
					if (n2 >= 1)
						n2--;
					else
						continue;

			}
			sol.push_back(make_pair(a, b));
			parent[roota] = rootb;
		}

	}
	if (sol.size() == n - 1) {
		cout << "Yes" << endl;
		for (int i = 0; i < sol.size(); ++i) {
			printf("%d %d\n", sol[i].first, sol[i].second);
		}
	}
	else
		cout << "No" << endl;

}


#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<ctime>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<deque>
#include<cstdlib>
#include<assert.h>
#include<ctime>
#include<time.h>

inline int Rand (){ return (rand () << 16) ^ rand ();}
#define fi first
#define se second
#define mp make_pair
#define SZ(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)
#define tim ((clock() * 1.0) / CLOCKS_PER_SEC)
#define repu(i, x, y) for (int i = int (x); i <= int (y); i++)
#define repd(i, y, x) for (int i = int (y); i >= int (x); i--)
#define repst(i, st) for (set <int> :: iterator i = st.begin (); i != st.end (); i++)
#define repstp(i, st) for (set <pair <int, int> > :: iterator i = st.begin (); i != st.end (); i++)
#define sc scanf
#define pnt printf

typedef long long ll;

using namespace std;

const int N = 100001, M1 = 1000000007, M2 = 1000000003, BIG = 1000001, MSK = 21, ALPH = 28, SMALL = 101;
const ll _prime = ll(1e6) + 3;

int mod(int x, int y) { return (x >= y ? x - y : x); }

struct Hash {
	int x, y;
	Hash() { x = 0, y = 0; }
	Hash(int _x, int _y) { x = _x, y = _y; }
	Hash operator +(int _x) const { return Hash(mod(x + _x, M1), mod(y + _x, M2)); }
	Hash operator -(int _x) const { return Hash(mod(x + M1 - _x, M1), mod(y + M2 - _x, M2)); }
	Hash operator +(Hash B) const { return Hash(mod(x + B.x, M1), mod(y + B.y, M2)); }
	Hash operator -(Hash B) const { return Hash(mod(x + M1 - B.x, M1), mod(y + M2 - B.y, M2)); }
	Hash operator *(ll _x) const { return Hash((x * 1ll * (_x % M1)) % M1, (y * 1ll * (_x % M2)) % M2); }
	Hash operator *(Hash B) const { return Hash((x * 1ll * B.x) % M1, (y * 1ll * B.y) % M2); }
	bool operator !=(Hash B) const { return x != B.x || y != B.y; }
	bool operator ==(Hash B) const { return x == B.x && y == B.y; }
};

struct Pnt{
	long long x, y;
	Pnt() {}
	Pnt(long long _x, long long _y) {x = _x, y = _y;}
	Pnt operator -(Pnt b) const { return Pnt(x - b.x, y - b.y); }
	Pnt operator +(Pnt b) const { return Pnt(x + b.x, y + b.y); }
	Pnt operator +(long long _x) const {return Pnt(x + _x, y + _x); }
	long long operator *(Pnt b) const { return (x * b.x + y * b.y); }
	long long operator %(Pnt b) const { return (x * b.y - y * b.x); }
	long long sq_len() const {
		return x * x + y * y;
	}
	bool operator ==(Pnt b) const { return x == b.x && y == b.y; }
};

struct Ln {
	long long a, b, c;
	Ln() {}
	Ln(long long aa, long long bb, long long cc) { a = aa, b = bb, c = cc; }
	Ln(Pnt d, Pnt e) {
		a = d.y - e.y;
		b = e.x - d.x;
		c = -a * d.x - b * d.y;
	}
	double Dist(Pnt d) const { return (a * d.x + b * d.y + c) / sqrt(sqr(a) + sqr(b)); }
	bool operator ==(Ln B) const { return a == B.a && b == B.b && c == B.c; }
};

int n, m, x, y, s, f, cnt[BIG], ds, df;
vector <int> g[BIG];
vector <pair <int, int> > ans;
bool used[BIG];

void dfs(int v) {
	used[v] = true;
	repu(i, 0, SZ(g[v]) - 1) {
		int to = g[v][i];
		if (!used[to])
			cnt[v]++, ans.pb(mp(v, to)), dfs(to);
	}
}

int main(){
	sc("%d %d", &n, &m);
	repu(i, 1, m)
		sc("%d %d", &x, &y), g[x].pb(y), g[y].pb(x);
	sc("%d %d %d %d", &s, &f, &ds, &df);
	dfs(s);
	if (ds < cnt[s] || df < cnt[f])
		cout << "No", ex;
	cout << "Yes" << endl;
	repu(i, 0, SZ(ans) - 1)
		cout << ans[i].fi << " " << ans[i].se << endl;
	return 0;
}


#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<ctime>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<deque>
#include<cstdlib>
#include<assert.h>
#include<ctime>
#include<time.h>

inline int Rand (){ return (rand () << 16) ^ rand ();}
#define fi first
#define se second
#define mp make_pair
#define SZ(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)
#define tim ((clock() * 1.0) / CLOCKS_PER_SEC)
#define repu(i, x, y) for (int i = int (x); i <= int (y); i++)
#define repd(i, y, x) for (int i = int (y); i >= int (x); i--)
#define repst(i, st) for (set <int> :: iterator i = st.begin (); i != st.end (); i++)
#define repstp(i, st) for (set <pair <int, int> > :: iterator i = st.begin (); i != st.end (); i++)
#define sc scanf
#define pnt printf

typedef long long ll;

using namespace std;

const int N = 100001, M1 = 1000000007, M2 = 1000000003, BIG = 200501, MSK = 21, ALPH = 28, SMALL = 101;
const ll _prime = ll(1e6) + 3;

int mod(int x, int y) { return (x >= y ? x - y : x); }

struct Hash {
	int x, y;
	Hash() { x = 0, y = 0; }
	Hash(int _x, int _y) { x = _x, y = _y; }
	Hash operator +(int _x) const { return Hash(mod(x + _x, M1), mod(y + _x, M2)); }
	Hash operator -(int _x) const { return Hash(mod(x + M1 - _x, M1), mod(y + M2 - _x, M2)); }
	Hash operator +(Hash B) const { return Hash(mod(x + B.x, M1), mod(y + B.y, M2)); }
	Hash operator -(Hash B) const { return Hash(mod(x + M1 - B.x, M1), mod(y + M2 - B.y, M2)); }
	Hash operator *(ll _x) const { return Hash((x * 1ll * (_x % M1)) % M1, (y * 1ll * (_x % M2)) % M2); }
	Hash operator *(Hash B) const { return Hash((x * 1ll * B.x) % M1, (y * 1ll * B.y) % M2); }
	bool operator !=(Hash B) const { return x != B.x || y != B.y; }
	bool operator ==(Hash B) const { return x == B.x && y == B.y; }
};

struct Pnt{
	long long x, y;
	Pnt() {}
	Pnt(long long _x, long long _y) {x = _x, y = _y;}
	Pnt operator -(Pnt b) const { return Pnt(x - b.x, y - b.y); }
	Pnt operator +(Pnt b) const { return Pnt(x + b.x, y + b.y); }
	Pnt operator +(long long _x) const {return Pnt(x + _x, y + _x); }
	long long operator *(Pnt b) const { return (x * b.x + y * b.y); }
	long long operator %(Pnt b) const { return (x * b.y - y * b.x); }
	long long sq_len() const {
		return x * x + y * y;
	}
	bool operator ==(Pnt b) const { return x == b.x && y == b.y; }
};

struct Ln {
	long long a, b, c;
	Ln() {}
	Ln(long long aa, long long bb, long long cc) { a = aa, b = bb, c = cc; }
	Ln(Pnt d, Pnt e) {
		a = d.y - e.y;
		b = e.x - d.x;
		c = -a * d.x - b * d.y;
	}
	double Dist(Pnt d) const { return (a * d.x + b * d.y + c) / sqrt(sqr(a) + sqr(b)); }
	bool operator ==(Ln B) const { return a == B.a && b == B.b && c == B.c; }
};

int n, m, x, y, s, f, cnt[5], tin[BIG], ds, df;
vector <int> g[BIG];
vector <pair <int, int> > ans;
bool used[BIG];

int z(int v) {
	if (v == s) return 0;
	if (v == f) return 1;
	return 2;
}

void mk(int v, int to) { ans.pb(mp(v, to)), cnt[z(v)]++, cnt[z(to)]++; }

void go(int v, int col) {
	tin[v] = col;
	used[v] = true;
	repu(i, 0, SZ(g[v]) - 1) {
		int to = g[v][i];
		if (used[to] || to == f)
			continue;
		go(to, col);
		mk(v, to);
	}
}

int main(){
	sc("%d %d", &n, &m);
	repu(i, 1, m)
		sc("%d %d", &x, &y), g[x].pb(y), g[y].pb(x);
	sc("%d %d %d %d", &s, &f, &ds, &df);

	go(s, s);
	go(f, f);
	int to = -1;
	repu(i, 0, SZ(g[f]) - 1)
		if (tin[g[f][i]] == s)
			if (g[f][i] != s)
				to = g[f][i];
	if (to == -1)
		to = s;
	mk(f, to);
	if (cnt[0] > ds || cnt[1] > df)
		cout << "No", ex;
	cout << "Yes" << endl;
	repu(i, 0, SZ(ans) - 1)
		cout << ans[i].fi << " " << ans[i].se << endl;
	return 0;
}


#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<ctime>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<deque>
#include<cstdlib>
#include<assert.h>
#include<ctime>
#include<time.h>

inline int Rand (){ return (rand () << 16) ^ rand ();}
#define fi first
#define se second
#define mp make_pair
#define SZ(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)
#define tim ((clock() * 1.0) / CLOCKS_PER_SEC)
#define repu(i, x, y) for (int i = int (x); i <= int (y); i++)
#define repd(i, y, x) for (int i = int (y); i >= int (x); i--)
#define repst(i, st) for (set <int> :: iterator i = st.begin (); i != st.end (); i++)
#define repstp(i, st) for (set <pair <int, int> > :: iterator i = st.begin (); i != st.end (); i++)
#define sc scanf
#define pnt printf

typedef long long ll;

using namespace std;

const int N = 100001, M1 = 1000000007, M2 = 1000000003, BIG = 1000001, MSK = 21, ALPH = 28, SMALL = 101;
const ll _prime = ll(1e6) + 3;

int mod(int x, int y) { return (x >= y ? x - y : x); }

struct Hash {
	int x, y;
	Hash() { x = 0, y = 0; }
	Hash(int _x, int _y) { x = _x, y = _y; }
	Hash operator +(int _x) const { return Hash(mod(x + _x, M1), mod(y + _x, M2)); }
	Hash operator -(int _x) const { return Hash(mod(x + M1 - _x, M1), mod(y + M2 - _x, M2)); }
	Hash operator +(Hash B) const { return Hash(mod(x + B.x, M1), mod(y + B.y, M2)); }
	Hash operator -(Hash B) const { return Hash(mod(x + M1 - B.x, M1), mod(y + M2 - B.y, M2)); }
	Hash operator *(ll _x) const { return Hash((x * 1ll * (_x % M1)) % M1, (y * 1ll * (_x % M2)) % M2); }
	Hash operator *(Hash B) const { return Hash((x * 1ll * B.x) % M1, (y * 1ll * B.y) % M2); }
	bool operator !=(Hash B) const { return x != B.x || y != B.y; }
	bool operator ==(Hash B) const { return x == B.x && y == B.y; }
};

struct Pnt{
	long long x, y;
	Pnt() {}
	Pnt(long long _x, long long _y) {x = _x, y = _y;}
	Pnt operator -(Pnt b) const { return Pnt(x - b.x, y - b.y); }
	Pnt operator +(Pnt b) const { return Pnt(x + b.x, y + b.y); }
	Pnt operator +(long long _x) const {return Pnt(x + _x, y + _x); }
	long long operator *(Pnt b) const { return (x * b.x + y * b.y); }
	long long operator %(Pnt b) const { return (x * b.y - y * b.x); }
	long long sq_len() const {
		return x * x + y * y;
	}
	bool operator ==(Pnt b) const { return x == b.x && y == b.y; }
};

struct Ln {
	long long a, b, c;
	Ln() {}
	Ln(long long aa, long long bb, long long cc) { a = aa, b = bb, c = cc; }
	Ln(Pnt d, Pnt e) {
		a = d.y - e.y;
		b = e.x - d.x;
		c = -a * d.x - b * d.y;
	}
	double Dist(Pnt d) const { return (a * d.x + b * d.y + c) / sqrt(sqr(a) + sqr(b)); }
	bool operator ==(Ln B) const { return a == B.a && b == B.b && c == B.c; }
};

int n, m, x, y, s, f, cnt[5], tin[BIG], ds, df;
vector <int> g[BIG];
vector <pair <int, int> > ans;
bool used[BIG];

int z(int v) {
	if (v == s) return 0;
	if (v == f) return 1;
	return 2;
}

void mk(int v, int to) { ans.pb(mp(v, to)), cnt[z(v)]++, cnt[z(to)]++; }

void go(int v, int col) {
	tin[v] = col;
	used[v] = true;
	repu(i, 0, SZ(g[v]) - 1) {
		int to = g[v][i];
		if (used[to] || to == f)
			continue;
		go(to, col);
		mk(v, to);
	}
}

int main(){
	sc("%d %d", &n, &m);
	repu(i, 1, m)
		sc("%d %d", &x, &y), g[x].pb(y), g[y].pb(x);
	sc("%d %d %d %d", &s, &f, &ds, &df);

	go(s, s);
	go(f, f);
	int to = -1;
	repu(i, 0, SZ(g[f]) - 1)
		if (tin[g[f][i]] == s)
			if (g[f][i] != s)
				to = g[f][i];
	if (to == -1)
		to = s;
	mk(f, to);
	if (cnt[0] > ds || cnt[1] > df)
		cout << "No", ex;
	cout << "Yes" << endl;
	repu(i, 0, SZ(ans) - 1)
		cout << ans[i].fi << " " << ans[i].se << endl;
	return 0;
}


#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<ctime>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<deque>
#include<cstdlib>
#include<assert.h>
#include<ctime>
#include<time.h>

inline int Rand (){ return (rand () << 16) ^ rand ();}
#define fi first
#define se second
#define mp make_pair
#define SZ(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)
#define tim ((clock() * 1.0) / CLOCKS_PER_SEC)
#define repu(i, x, y) for (int i = int (x); i <= int (y); i++)
#define repd(i, y, x) for (int i = int (y); i >= int (x); i--)
#define repst(i, st) for (set <int> :: iterator i = st.begin (); i != st.end (); i++)
#define repstp(i, st) for (set <pair <int, int> > :: iterator i = st.begin (); i != st.end (); i++)
#define sc scanf
#define pnt printf

typedef long long ll;

using namespace std;

const int N = 100001, M1 = 1000000007, M2 = 1000000003, BIG = 1000001, MSK = 21, ALPH = 28, SMALL = 101;
const ll _prime = ll(1e6) + 3;

int mod(int x, int y) { return (x >= y ? x - y : x); }

struct Hash {
	int x, y;
	Hash() { x = 0, y = 0; }
	Hash(int _x, int _y) { x = _x, y = _y; }
	Hash operator +(int _x) const { return Hash(mod(x + _x, M1), mod(y + _x, M2)); }
	Hash operator -(int _x) const { return Hash(mod(x + M1 - _x, M1), mod(y + M2 - _x, M2)); }
	Hash operator +(Hash B) const { return Hash(mod(x + B.x, M1), mod(y + B.y, M2)); }
	Hash operator -(Hash B) const { return Hash(mod(x + M1 - B.x, M1), mod(y + M2 - B.y, M2)); }
	Hash operator *(ll _x) const { return Hash((x * 1ll * (_x % M1)) % M1, (y * 1ll * (_x % M2)) % M2); }
	Hash operator *(Hash B) const { return Hash((x * 1ll * B.x) % M1, (y * 1ll * B.y) % M2); }
	bool operator !=(Hash B) const { return x != B.x || y != B.y; }
	bool operator ==(Hash B) const { return x == B.x && y == B.y; }
};

struct Pnt{
	long long x, y;
	Pnt() {}
	Pnt(long long _x, long long _y) {x = _x, y = _y;}
	Pnt operator -(Pnt b) const { return Pnt(x - b.x, y - b.y); }
	Pnt operator +(Pnt b) const { return Pnt(x + b.x, y + b.y); }
	Pnt operator +(long long _x) const {return Pnt(x + _x, y + _x); }
	long long operator *(Pnt b) const { return (x * b.x + y * b.y); }
	long long operator %(Pnt b) const { return (x * b.y - y * b.x); }
	long long sq_len() const {
		return x * x + y * y;
	}
	bool operator ==(Pnt b) const { return x == b.x && y == b.y; }
};

struct Ln {
	long long a, b, c;
	Ln() {}
	Ln(long long aa, long long bb, long long cc) { a = aa, b = bb, c = cc; }
	Ln(Pnt d, Pnt e) {
		a = d.y - e.y;
		b = e.x - d.x;
		c = -a * d.x - b * d.y;
	}
	double Dist(Pnt d) const { return (a * d.x + b * d.y + c) / sqrt(sqr(a) + sqr(b)); }
	bool operator ==(Ln B) const { return a == B.a && b == B.b && c == B.c; }
};

int n, m, x, fup[BIG], tin[BIG], timer, bridges[BIG], y, s, f, cnt[5], ds, df;
vector <int> g[BIG];
vector <pair <int, int> > ans;
bool used[BIG];

bool is_bridge(int v, int u) { return (fup[u] > tin[v]); }

void work(int v, int pr = 0) {
	used[v] = true;
	fup[v] = tin[v] = ++timer;
	repu(i, 0, SZ(g[v]) - 1) {
		int to = g[v][i];
		if (to == pr)
			continue;
		if (used[to])
			fup[v] = min(fup[v], tin[to]);
		else {
			work(to, v), fup[v] = min(fup[v], fup[to]);
			if (is_bridge(v, to))
				bridges[v]++;
		}
	}
}

int z(int v) {
	if (v == s) return 0;
	if (v == f) return 1;
	return 2;
}

void go(int v) {
	used[v] = true;
	repu(i, 0, SZ(g[v]) - 1) {
		int to = g[v][i];
		if (used[to])
			continue;
		if (is_bridge(v, to))
			go(to), ans.pb(mp(v, to)), cnt[z(v)]++, cnt[z(to)]++;
		else if (to == f || v == s) {
			if (SZ(g[v]) - (v == s ? 0 : 1) - bridges[v] == 1)
				go(to), ans.pb(mp(v, to)), cnt[z(v)]++, cnt[z(to)]++;
			else
				bridges[v]++;
		} else go(to), ans.pb(mp(v, to)), cnt[z(v)]++, cnt[z(to)]++;
	}
}

int main(){
	sc("%d %d", &n, &m);
	repu(i, 1, m)
		sc("%d %d", &x, &y), g[x].pb(y), g[y].pb(x);
	sc("%d %d %d %d", &s, &f, &ds, &df);
	work(s);
	repu(i, 1, n) used[i] = false;
	go(s);
	if (cnt[0] > ds || cnt[1] > df)
		cout << "No", ex;
	cout << "Yes" << endl;
	repu(i, 0, SZ(ans) - 1)
		cout << ans[i].fi << " " << ans[i].se << endl;
	return 0;
}


#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<ctime>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<deque>
#include<cstdlib>
#include<assert.h>
#include<ctime>
#include<time.h>
#include <unordered_map>

inline int Rand (){ return (rand () << 16) ^ rand ();}
#define fi first
#define se second
#define mp make_pair
#define SZ(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)
#define tim ((clock() * 1.0) / CLOCKS_PER_SEC)
#define repu(i, x, y) for (int i = int (x); i <= int (y); i++)
#define repd(i, y, x) for (int i = int (y); i >= int (x); i--)
#define repst(i, st) for (set <int> :: iterator i = st.begin (); i != st.end (); i++)
#define repstp(i, st) for (set <pair <int, int> > :: iterator i = st.begin (); i != st.end (); i++)
#define sc scanf
#define pnt printf

typedef long long ll;

using namespace std;

const int N = 100001, M1 = 1000000007, M2 = 1000000003, BIG = 200501, MSK = 21, ALPH = 28, SMALL = 101;
const ll _prime = ll(1e6) + 3;

int mod(int x, int y) { return (x >= y ? x - y : x); }

struct Hash {
	int x, y;
	Hash() { x = 0, y = 0; }
	Hash(int _x, int _y) { x = _x, y = _y; }
	Hash operator +(int _x) const { return Hash(mod(x + _x, M1), mod(y + _x, M2)); }
	Hash operator -(int _x) const { return Hash(mod(x + M1 - _x, M1), mod(y + M2 - _x, M2)); }
	Hash operator +(Hash B) const { return Hash(mod(x + B.x, M1), mod(y + B.y, M2)); }
	Hash operator -(Hash B) const { return Hash(mod(x + M1 - B.x, M1), mod(y + M2 - B.y, M2)); }
	Hash operator *(ll _x) const { return Hash((x * 1ll * (_x % M1)) % M1, (y * 1ll * (_x % M2)) % M2); }
	Hash operator *(Hash B) const { return Hash((x * 1ll * B.x) % M1, (y * 1ll * B.y) % M2); }
	bool operator !=(Hash B) const { return x != B.x || y != B.y; }
	bool operator ==(Hash B) const { return x == B.x && y == B.y; }
};

struct Pnt{
	long long x, y;
	Pnt() {}
	Pnt(long long _x, long long _y) {x = _x, y = _y;}
	Pnt operator -(Pnt b) const { return Pnt(x - b.x, y - b.y); }
	Pnt operator +(Pnt b) const { return Pnt(x + b.x, y + b.y); }
	Pnt operator +(long long _x) const {return Pnt(x + _x, y + _x); }
	long long operator *(Pnt b) const { return (x * b.x + y * b.y); }
	long long operator %(Pnt b) const { return (x * b.y - y * b.x); }
	long long sq_len() const {
		return x * x + y * y;
	}
	bool operator ==(Pnt b) const { return x == b.x && y == b.y; }
};

struct Ln {
	long long a, b, c;
	Ln() {}
	Ln(long long aa, long long bb, long long cc) { a = aa, b = bb, c = cc; }
	Ln(Pnt d, Pnt e) {
		a = d.y - e.y;
		b = e.x - d.x;
		c = -a * d.x - b * d.y;
	}
	double Dist(Pnt d) const { return (a * d.x + b * d.y + c) / sqrt(sqr(a) + sqr(b)); }
	bool operator ==(Ln B) const { return a == B.a && b == B.b && c == B.c; }
};

int n, m, x, y, s, f, cnt[5], tin[BIG], counter, ds, df;
vector <int> g[BIG];
set <pair <int, int> > ans;
bool used[BIG];
unordered_map <int, int> can[BIG];

int z(int v) {
	if (v == s) return 0;
	if (v == f) return 1;
	return 2;
}

void mk(int v, int to) { ans.insert(mp(v, to)), cnt[z(v)]++, cnt[z(to)]++; }

void go(int v, int col) {
	tin[v] = col;
	used[v] = true;
	repu(i, 0, SZ(g[v]) - 1) {
		int to = g[v][i];
		if (used[to] || to == f)
			continue;
		go(to, col);
		mk(v, to);
	}
}

int main(){

	sc("%d %d", &n, &m);
	repu(i, 1, m)
		sc("%d %d", &x, &y), g[x].pb(y), g[y].pb(x), can[x][y] = true, can[y][x] = true;
	sc("%d %d %d %d", &s, &f, &ds, &df);

	go(s, s);
	go(f, f);
	int to = -1;
	bool ok = false;
	repu(i, 0, SZ(g[f]) - 1)
		if (tin[g[f][i]] == s)
			if (g[f][i] != s)
				to = g[f][i];
	if (to == -1)
		to = s;
	mk(f, to);
	repu(i, 0, SZ(g[f]) - 1) {
		int to = g[f][i];
		if (cnt[1] + 1 <= df && cnt[0] > ds && can[s][to] && ans.find(mp(s, to)) != ans.end())
			ans.erase(mp(s, to)), cnt[1]++, cnt[0]--, ans.insert(mp(f, to));
	}
	if (cnt[0] > ds || cnt[1] > df)
		cout << "No", ex;
	cout << "Yes" << endl;
	repstp(i, ans)
		printf("%d %d\n", i -> fi, i -> se);
	return 0;
}


#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<ctime>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<deque>
#include<cstdlib>
#include<assert.h>
#include<ctime>
#include<time.h>

inline int Rand (){ return (rand () << 16) ^ rand ();}
#define fi first
#define se second
#define mp make_pair
#define SZ(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)
#define tim ((clock() * 1.0) / CLOCKS_PER_SEC)
#define repu(i, x, y) for (int i = int (x); i <= int (y); i++)
#define repd(i, y, x) for (int i = int (y); i >= int (x); i--)
#define repst(i, st) for (set <int> :: iterator i = st.begin (); i != st.end (); i++)
#define repstp(i, st) for (set <pair <int, int> > :: iterator i = st.begin (); i != st.end (); i++)
#define sc scanf
#define pnt printf

typedef long long ll;

using namespace std;

const int N = 100001, M1 = 1000000007, M2 = 1000000003, BIG = 200501, MSK = 21, ALPH = 28, SMALL = 101;
const ll _prime = ll(1e6) + 3;

int mod(int x, int y) { return (x >= y ? x - y : x); }

struct Hash {
	int x, y;
	Hash() { x = 0, y = 0; }
	Hash(int _x, int _y) { x = _x, y = _y; }
	Hash operator +(int _x) const { return Hash(mod(x + _x, M1), mod(y + _x, M2)); }
	Hash operator -(int _x) const { return Hash(mod(x + M1 - _x, M1), mod(y + M2 - _x, M2)); }
	Hash operator +(Hash B) const { return Hash(mod(x + B.x, M1), mod(y + B.y, M2)); }
	Hash operator -(Hash B) const { return Hash(mod(x + M1 - B.x, M1), mod(y + M2 - B.y, M2)); }
	Hash operator *(ll _x) const { return Hash((x * 1ll * (_x % M1)) % M1, (y * 1ll * (_x % M2)) % M2); }
	Hash operator *(Hash B) const { return Hash((x * 1ll * B.x) % M1, (y * 1ll * B.y) % M2); }
	bool operator !=(Hash B) const { return x != B.x || y != B.y; }
	bool operator ==(Hash B) const { return x == B.x && y == B.y; }
};

struct Pnt{
	long long x, y;
	Pnt() {}
	Pnt(long long _x, long long _y) {x = _x, y = _y;}
	Pnt operator -(Pnt b) const { return Pnt(x - b.x, y - b.y); }
	Pnt operator +(Pnt b) const { return Pnt(x + b.x, y + b.y); }
	Pnt operator +(long long _x) const {return Pnt(x + _x, y + _x); }
	long long operator *(Pnt b) const { return (x * b.x + y * b.y); }
	long long operator %(Pnt b) const { return (x * b.y - y * b.x); }
	long long sq_len() const {
		return x * x + y * y;
	}
	bool operator ==(Pnt b) const { return x == b.x && y == b.y; }
};

struct Ln {
	long long a, b, c;
	Ln() {}
	Ln(long long aa, long long bb, long long cc) { a = aa, b = bb, c = cc; }
	Ln(Pnt d, Pnt e) {
		a = d.y - e.y;
		b = e.x - d.x;
		c = -a * d.x - b * d.y;
	}
	double Dist(Pnt d) const { return (a * d.x + b * d.y + c) / sqrt(sqr(a) + sqr(b)); }
	bool operator ==(Ln B) const { return a == B.a && b == B.b && c == B.c; }
};

int n, m, x, y, s, f, cnt[5], tin[BIG], counter, ds, df;
vector <int> g[BIG];
vector <pair <int, int> > ans;
bool used[BIG];

int z(int v) {
	if (v == s) return 0;
	if (v == f) return 1;
	return 2;
}

void mk(int v, int to) { ans.pb(mp(v, to)), cnt[z(v)]++, cnt[z(to)]++; }

void go(int v, int col) {
	tin[v] = col;
	used[v] = true;
	repu(i, 0, SZ(g[v]) - 1) {
		int to = g[v][i];
		if (used[to] || to == f)
			continue;
		if (v == s)
			counter++;
		if (v == s && counter > ds)
			break;
		go(to, col);
		mk(v, to);
	}
}

int main(){
	sc("%d %d", &n, &m);
	repu(i, 1, m)
		sc("%d %d", &x, &y), g[x].pb(y), g[y].pb(x);
	sc("%d %d %d %d", &s, &f, &ds, &df);

	go(s, s);
	go(f, f);
	int to = -1;
	bool ok = false;
	repu(i, 0, SZ(g[f]) - 1)
		if (tin[g[f][i]] == s)
			if (g[f][i] != s)
				to = g[f][i];
			else ok = true;
	if (to == -1)
		if (ok)
			to = s;
		else
			cout << "No", ex;
	mk(f, to);
	if (cnt[0] > ds || cnt[1] > df)
		cout << "No", ex;
	cout << "Yes" << endl;
	repu(i, 0, SZ(ans) - 1)
		cout << ans[i].fi << " " << ans[i].se << endl;
	return 0;
}


#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<ctime>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<deque>
#include<cstdlib>
#include<assert.h>
#include<ctime>
#include<time.h>

inline int Rand (){ return (rand () << 16) ^ rand ();}
#define fi first
#define se second
#define mp make_pair
#define SZ(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)
#define tim ((clock() * 1.0) / CLOCKS_PER_SEC)
#define repu(i, x, y) for (int i = int (x); i <= int (y); i++)
#define repd(i, y, x) for (int i = int (y); i >= int (x); i--)
#define repst(i, st) for (set <int> :: iterator i = st.begin (); i != st.end (); i++)
#define repstp(i, st) for (set <pair <int, int> > :: iterator i = st.begin (); i != st.end (); i++)
#define sc scanf
#define pnt printf

typedef long long ll;

using namespace std;

const int N = 100001, M1 = 1000000007, M2 = 1000000003, BIG = 1000001, MSK = 21, ALPH = 28, SMALL = 101;
const ll _prime = ll(1e6) + 3;

int mod(int x, int y) { return (x >= y ? x - y : x); }

struct Hash {
	int x, y;
	Hash() { x = 0, y = 0; }
	Hash(int _x, int _y) { x = _x, y = _y; }
	Hash operator +(int _x) const { return Hash(mod(x + _x, M1), mod(y + _x, M2)); }
	Hash operator -(int _x) const { return Hash(mod(x + M1 - _x, M1), mod(y + M2 - _x, M2)); }
	Hash operator +(Hash B) const { return Hash(mod(x + B.x, M1), mod(y + B.y, M2)); }
	Hash operator -(Hash B) const { return Hash(mod(x + M1 - B.x, M1), mod(y + M2 - B.y, M2)); }
	Hash operator *(ll _x) const { return Hash((x * 1ll * (_x % M1)) % M1, (y * 1ll * (_x % M2)) % M2); }
	Hash operator *(Hash B) const { return Hash((x * 1ll * B.x) % M1, (y * 1ll * B.y) % M2); }
	bool operator !=(Hash B) const { return x != B.x || y != B.y; }
	bool operator ==(Hash B) const { return x == B.x && y == B.y; }
};

struct Pnt{
	long long x, y;
	Pnt() {}
	Pnt(long long _x, long long _y) {x = _x, y = _y;}
	Pnt operator -(Pnt b) const { return Pnt(x - b.x, y - b.y); }
	Pnt operator +(Pnt b) const { return Pnt(x + b.x, y + b.y); }
	Pnt operator +(long long _x) const {return Pnt(x + _x, y + _x); }
	long long operator *(Pnt b) const { return (x * b.x + y * b.y); }
	long long operator %(Pnt b) const { return (x * b.y - y * b.x); }
	long long sq_len() const {
		return x * x + y * y;
	}
	bool operator ==(Pnt b) const { return x == b.x && y == b.y; }
};

struct Ln {
	long long a, b, c;
	Ln() {}
	Ln(long long aa, long long bb, long long cc) { a = aa, b = bb, c = cc; }
	Ln(Pnt d, Pnt e) {
		a = d.y - e.y;
		b = e.x - d.x;
		c = -a * d.x - b * d.y;
	}
	double Dist(Pnt d) const { return (a * d.x + b * d.y + c) / sqrt(sqr(a) + sqr(b)); }
	bool operator ==(Ln B) const { return a == B.a && b == B.b && c == B.c; }
};

int n, m, x, y, s, f, cnt[BIG], ds, df;
vector <int> g[BIG];
vector <pair <int, int> > ans;
bool used[BIG];

void dfs(int v) {
	used[v] = true;
	repu(i, 0, SZ(g[v]) - 1) {
		int to = g[v][i];
		if (!used[to])
			cnt[v]++, ans.pb(mp(v, to)), dfs(to);
	}
}

int main(){
	sc("%d %d", &n, &m);
	repu(i, 1, m)
		sc("%d %d", &x, &y), g[x].pb(y), g[y].pb(x);
	sc("%d %d %d %d", &s, &f, &ds, &df);
	dfs(s);
	if (ds < cnt[s] || df < cnt[f])
		cout << "NO", ex;
	cout << "YES" << endl;
	repu(i, 0, SZ(ans) - 1)
		cout << ans[i].fi << " " << ans[i].se << endl;
	return 0;
}


#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<ctime>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<deque>
#include<cstdlib>
#include<assert.h>
#include<ctime>
#include<time.h>

inline int Rand (){ return (rand () << 16) ^ rand ();}
#define fi first
#define se second
#define mp make_pair
#define SZ(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)
#define tim ((clock() * 1.0) / CLOCKS_PER_SEC)
#define repu(i, x, y) for (int i = int (x); i <= int (y); i++)
#define repd(i, y, x) for (int i = int (y); i >= int (x); i--)
#define repst(i, st) for (set <int> :: iterator i = st.begin (); i != st.end (); i++)
#define repstp(i, st) for (set <pair <int, int> > :: iterator i = st.begin (); i != st.end (); i++)
#define sc scanf
#define pnt printf

typedef long long ll;

using namespace std;

const int N = 100001, M1 = 1000000007, M2 = 1000000003, BIG = 200501, MSK = 21, ALPH = 28, SMALL = 101;
const ll _prime = ll(1e6) + 3;

int mod(int x, int y) { return (x >= y ? x - y : x); }

struct Hash {
	int x, y;
	Hash() { x = 0, y = 0; }
	Hash(int _x, int _y) { x = _x, y = _y; }
	Hash operator +(int _x) const { return Hash(mod(x + _x, M1), mod(y + _x, M2)); }
	Hash operator -(int _x) const { return Hash(mod(x + M1 - _x, M1), mod(y + M2 - _x, M2)); }
	Hash operator +(Hash B) const { return Hash(mod(x + B.x, M1), mod(y + B.y, M2)); }
	Hash operator -(Hash B) const { return Hash(mod(x + M1 - B.x, M1), mod(y + M2 - B.y, M2)); }
	Hash operator *(ll _x) const { return Hash((x * 1ll * (_x % M1)) % M1, (y * 1ll * (_x % M2)) % M2); }
	Hash operator *(Hash B) const { return Hash((x * 1ll * B.x) % M1, (y * 1ll * B.y) % M2); }
	bool operator !=(Hash B) const { return x != B.x || y != B.y; }
	bool operator ==(Hash B) const { return x == B.x && y == B.y; }
};

struct Pnt{
	long long x, y;
	Pnt() {}
	Pnt(long long _x, long long _y) {x = _x, y = _y;}
	Pnt operator -(Pnt b) const { return Pnt(x - b.x, y - b.y); }
	Pnt operator +(Pnt b) const { return Pnt(x + b.x, y + b.y); }
	Pnt operator +(long long _x) const {return Pnt(x + _x, y + _x); }
	long long operator *(Pnt b) const { return (x * b.x + y * b.y); }
	long long operator %(Pnt b) const { return (x * b.y - y * b.x); }
	long long sq_len() const {
		return x * x + y * y;
	}
	bool operator ==(Pnt b) const { return x == b.x && y == b.y; }
};

struct Ln {
	long long a, b, c;
	Ln() {}
	Ln(long long aa, long long bb, long long cc) { a = aa, b = bb, c = cc; }
	Ln(Pnt d, Pnt e) {
		a = d.y - e.y;
		b = e.x - d.x;
		c = -a * d.x - b * d.y;
	}
	double Dist(Pnt d) const { return (a * d.x + b * d.y + c) / sqrt(sqr(a) + sqr(b)); }
	bool operator ==(Ln B) const { return a == B.a && b == B.b && c == B.c; }
};

int n, m, x, y, s, f, cnt[5], tin[BIG], counter, ds, df;
vector <int> g[BIG];
vector <pair <int, int> > ans;
bool used[BIG];

int z(int v) {
	if (v == s) return 0;
	if (v == f) return 1;
	return 2;
}

void mk(int v, int to) { ans.pb(mp(v, to)), cnt[z(v)]++, cnt[z(to)]++; }

void go(int v, int col) {
	tin[v] = col;
	used[v] = true;
	repu(i, 0, SZ(g[v]) - 1) {
		int to = g[v][i];
		if (used[to] || to == f)
			continue;
		if (v == s && col == s)
			counter++;
		if (v == s && col == s && counter > ds)
			break;
		go(to, col);
		mk(v, to);
	}
}

int main(){
	sc("%d %d", &n, &m);
	repu(i, 1, m)
		sc("%d %d", &x, &y), g[x].pb(y), g[y].pb(x);
	sc("%d %d %d %d", &s, &f, &ds, &df);

	go(s, s);
	go(f, f);
	int to = -1;
	repu(i, 0, SZ(g[f]) - 1)
		if (tin[g[f][i]] == s)
			if (g[f][i] != s)
				to = g[f][i];
	if (to == -1)
		to = s;
	mk(f, to);
	if (cnt[0] > ds || cnt[1] > df)
		cout << "No", ex;
	cout << "Yes" << endl;
	repu(i, 0, SZ(ans) - 1)
		cout << ans[i].fi << " " << ans[i].se << endl;
	return 0;
}


#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define pb push_back
#define sz size()
#define ln length()
#define fore(i,a,b) for(int i=a;i<b;i++)
#define fores(i,a,b) for(int i=a;i<=b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define ff first
#define ss second
#define sc(a) scanf("%d",&a)
#define md 1000000007

vector<vi> adj;
vector<pii> grph;
vi vis, component;
int s,t;

void dfs(int i, int k) {
    component[i] = k;
    fore(j,0,adj[i].sz) {
        if(vis[adj[i][j]]) {
            continue;
        }
        if(adj[i][j] == s || adj[i][j] == t) {
            continue;
        }
        vis[adj[i][j]] = 1;
        grph.pb(mp(i,adj[i][j]));
        dfs(adj[i][j], k);
    }
}
int main() {
    int n,m;
    cin>>n>>m;
    adj.resize(n);
    vis.resize(n);
    component.resize(n);
    fore(i,0,m) {
        int u,v;
        cin>>u>>v;
        adj[u-1].pb(v-1);
        adj[v-1].pb(u-1);
        //cout<<u-1<<" "<<v-1<<endl;
    }
//    fore(i,0,n) {
//        cout<<i<<" "<<adj[i].sz<<endl;
//    }
    fore(i,0,n) {
        vis[i] = 0;
    }
    int ds,dt;
    cin>>s>>t>>ds>>dt;
    s--;t--;

    int doneComponents = 1;
    fore(i,0,n) {
        if(i == s || i == t) {
            continue;
        }
        if(vis[i] == 0) {
            vis[i] = 1;
            dfs(i, doneComponents);
            doneComponents++;
        }
    }
    vector<vector<pii> > connectedTo(doneComponents-1);
    set<int> added;
    fore(j,0,adj[s].sz) {
        if(vis[adj[s][j]]) {
            if(added.find(component[adj[s][j]] - 1) == added.end()) {
                connectedTo[component[adj[s][j]] - 1].pb(mp(s,adj[s][j]));
                added.insert(component[adj[s][j]] - 1);
            }
        }
    }
    //cout<<t<<" lll "<<adj[t].sz<<endl;
    added.clear();
    fore(j,0,adj[t].sz) {
        //cout<<vis[adj[t][j]]<<" "<<adj[t][j]<<endl;
        if(vis[adj[t][j]]) {

            if(added.find(component[adj[t][j]] - 1) == added.end()) {
                //cout<<"here"<<endl;
                connectedTo[component[adj[t][j]] - 1].pb(mp(t,adj[t][j]));
                added.insert(component[adj[t][j]] - 1);
            }
        }
    }
    fore(i,0,doneComponents-1) {
        //cout<<connectedTo[i].sz<<endl;
        if(connectedTo[i].sz == 1) {
            if(connectedTo[i][0].ff == s) {
                grph.pb(mp(s,connectedTo[i][0].ss));
                ds--;
            }
            else {
                grph.pb(mp(t,connectedTo[i][0].ss));
                dt--;
            }
        }
    }
    if(ds<0 || dt<0) {
        cout<<"No";
        return 0;
    }
    //cout<<doneComponents - 1<<endl;
    bool foundTwoOnce = false;
    fore(i,0,doneComponents-1) {
        if(connectedTo[i].sz == 2) {
            if(!foundTwoOnce) {
                foundTwoOnce = true;
                //cout<<"here"<<endl;
                grph.pb(mp(s,connectedTo[i][0].ss));
                grph.pb(mp(t,connectedTo[i][0].ss));
                ds--;
                dt--;
            }
            else {
                if(ds>0) {
                    ds--;
                    grph.pb(mp(s,connectedTo[i][0].ss));
                }
                else {
                    dt--;
                    grph.pb(mp(t,connectedTo[i][0].ss));
                }
            }
        }
    }
    if(!foundTwoOnce) {
        ds--;
        dt--;
        bool cool = false;
        fore(i,0,adj[s].sz) {
            if(adj[s][i] == t) {
                cool = true;
            }
        }
        if(cool) {
            grph.pb(mp(s,t));
        }
        else {
            cout<<"No";
            return 0;
        }
    }
    if(dt<0 || ds<0) {
        cout << "No";
        return 0;
    }
    cout<<"Yes"<<endl;
    fore(i,0,n-1) {
        cout<<grph[i].ff + 1<<" "<<grph[i].ss + 1<<endl;
    }
    return 0;
}


#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define pb push_back
#define sz size()
#define ln length()
#define fore(i,a,b) for(int i=a;i<b;i++)
#define fores(i,a,b) for(int i=a;i<=b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define ff first
#define ss second
#define sc(a) scanf("%d",&a)
#define md 1000000007

vector<vi> adj;
vector<pii> grph;
vi vis, component;
int s,t;

void dfs(int i, int k) {
    component[i] = k;
    fore(j,0,adj[i].sz) {
        if(vis[adj[i][j]]) {
            continue;
        }
        if(adj[i][j] == s || adj[i][j] == t) {
        	continue;
        }
        vis[adj[i][j]] = 1;
        grph.pb(mp(i,adj[i][j]));
        dfs(adj[i][j], k);
    }
}
int main() {
    int n,m;
    cin>>n>>m;
    adj.resize(n);
    vis.resize(n);
    component.resize(n);
    fore(i,0,n) {
        int u,v;
        cin>>u>>v;
        adj[u-1].pb(v-1);
        adj[v-1].pb(u-1);
    }
    fore(i,0,n) {
        vis[i] = 0;
    }
    int ds,dt;
    cin>>s>>t>>ds>>dt;
    s--;t--;

    int doneComponents = 1;
    fore(i,0,n) {
        if(i == s || i == t) {
            continue;
        }
        if(vis[i] == 0) {
        	vis[i] = 1;
            dfs(i, doneComponents);
            doneComponents++;
        }
    }
    vector<vector<pii> > connectedTo(doneComponents-1);
    fore(j,0,adj[s].sz) {
        if(vis[adj[s][j]]) {
            connectedTo[component[adj[s][j]] - 1].pb(mp(s,adj[s][j]));
        }
    }
    fore(j,0,adj[t].sz) {
        if(vis[adj[t][j]]) {
            connectedTo[component[adj[t][j]] - 1].pb(mp(t,adj[t][j]));
        }
    }
    fore(i,0,doneComponents-1) {
    	//cout<<connectedTo[i].sz<<endl;
        if(connectedTo[i].sz == 1) {
            if(connectedTo[i][0].ff == s) {
                grph.pb(mp(s,connectedTo[i][0].ss));
                ds--;
            }
            else {
                grph.pb(mp(t,connectedTo[i][0].ss));
                dt--;
            }
        }
    }
    if(ds<0 || dt<0) {
        cout<<"No";
        return 0;
    }
    bool foundTwoOnce = false;
    fore(i,0,doneComponents-1) {
        if(connectedTo[i].sz == 2) {
            if(!foundTwoOnce) {
                foundTwoOnce = true;
                //cout<<"here"<<endl;
                grph.pb(mp(s,connectedTo[i][0].ss));
                grph.pb(mp(t,connectedTo[i][0].ss));
                ds--;
                dt--;
            }
            else {
                if(ds>0) {
                    ds--;
                    grph.pb(mp(s,connectedTo[i][0].ss));
                }
                else {
                    dt--;
                    grph.pb(mp(t,connectedTo[i][0].ss));
                }
            }
        }
    }
    if(!foundTwoOnce) {
        ds--;
        dt--;
        bool cool = false;
        fore(i,0,adj[s].sz) {
        	if(adj[s][i] == t) {
        		cool = true;
        	}
        }
        if(cool) {
        	grph.pb(mp(s,t));
        }
        else {
        	cout<<"No";
        	return 0;
        }
    }
    if(dt<0 || ds<0) {
        cout << "No";
        return 0;
    }
    cout<<"Yes"<<endl;
    fore(i,0,n-1) {
        cout<<grph[i].ff + 1<<" "<<grph[i].ss + 1<<endl;
    }
    return 0;
}


#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define pb push_back
#define sz size()
#define ln length()
#define fore(i,a,b) for(int i=a;i<b;i++)
#define fores(i,a,b) for(int i=a;i<=b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define ff first
#define ss second
#define sc(a) scanf("%d",&a)
#define md 1000000007

vector<vi> adj;
vector<pii> grph;
vi vis, component;
int s,t;

void dfs(int i, int k) {
    component[i] = k;
    fore(j,0,adj[i].sz) {
        if(vis[adj[i][j]]) {
            continue;
        }
        if(adj[i][j] == s || adj[i][j] == t) {
            continue;
        }
        vis[adj[i][j]] = 1;
        grph.pb(mp(i,adj[i][j]));
        //cout<<i<<" in dfs " <<adj[i][j]<<endl;
        dfs(adj[i][j], k);
    }
}
int main() {
    int n,m;
    cin>>n>>m;
    adj.resize(n);
    vis.resize(n);
    component.resize(n);
    fore(i,0,m) {
        int u,v;
        cin>>u>>v;
        adj[u-1].pb(v-1);
        adj[v-1].pb(u-1);
    }
    fore(i,0,n) {
        vis[i] = 0;
    }
    int ds,dt;
    cin>>s>>t>>ds>>dt;
    s--;t--;

    int doneComponents = 1;
    fore(i,0,n) {
        if(i == s || i == t) {
            continue;
        }
        if(vis[i] == 0) {
            vis[i] = 1;
            dfs(i, doneComponents);
            doneComponents++;
        }
    }
    vector<vector<pii> > connectedTo(doneComponents-1);
    set<int> added;
    fore(j,0,adj[s].sz) {
        if(vis[adj[s][j]]) {
            if(added.find(component[adj[s][j]] - 1) == added.end()) {
                connectedTo[component[adj[s][j]] - 1].pb(mp(s,adj[s][j]));
                added.insert(component[adj[s][j]] - 1);
            }
        }
    }
    //cout<<t<<" lll "<<adj[t].sz<<endl;
    added.clear();
    fore(j,0,adj[t].sz) {
        //cout<<vis[adj[t][j]]<<" "<<adj[t][j]<<endl;
        if(vis[adj[t][j]]) {

            if(added.find(component[adj[t][j]] - 1) == added.end()) {
                //cout<<"here"<<endl;
                connectedTo[component[adj[t][j]] - 1].pb(mp(t,adj[t][j]));
                added.insert(component[adj[t][j]] - 1);
            }
        }
    }
    fore(i,0,doneComponents-1) {
        //cout<<connectedTo[i].sz<<endl;
        if(connectedTo[i].sz == 1) {
            if(connectedTo[i][0].ff == s) {
                grph.pb(mp(s,connectedTo[i][0].ss));
                //cout<<s<<" in 1 connected "<<connectedTo[i][0].ss<<endl;
                ds--;
            }
            else if(connectedTo[i][0].ff == t){
                grph.pb(mp(t,connectedTo[i][0].ss));
                //cout<<t<<" in 1 connected "<<connectedTo[i][0].ss<<endl;
                dt--;
            }
        }
    }
    if(ds<0 || dt<0) {
        cout<<"No";
        return 0;
    }
    //cout<<doneComponents - 1<<endl;
    bool foundTwoOnce = false;
    fore(i,0,doneComponents-1) {
        if(connectedTo[i].sz == 2) {
            if(!foundTwoOnce) {
                foundTwoOnce = true;
                //cout<<"here"<<endl;
                fore(j,0,2) {
                    if(connectedTo[i][j].ff == s) {
                        grph.pb(mp(s,connectedTo[i][j].ss));
                        //cout<<s<<" in 2 connected "<<connectedTo[i][j].ss<<endl;
                        ds--;
                    }
                    else if(connectedTo[i][j].ff == t){
                        grph.pb(mp(t,connectedTo[i][j].ss));
                        //cout<<t<<" in 2 connected "<<connectedTo[i][j].ss<<endl;
                        dt--;
                    }
                }
//                grph.pb(mp(s,connectedTo[i][0].ss));
//                grph.pb(mp(t,connectedTo[i][0].ss));
//                cout<<s<<" in 2 connected "<<connectedTo[i][0].ss<<endl;
//                cout<<t<<" in 2 connected "<<connectedTo[i][0].ss<<endl;
//                ds--;
//                dt--;
            }
            else {
                if(ds>0) {
                    ds--;
                    grph.pb(mp(s,connectedTo[i][0].ss));
                    //cout<<s<<" in 2 connected "<<connectedTo[i][0].ss<<endl;
                }
                else {
                    dt--;
                    grph.pb(mp(t,connectedTo[i][0].ss));
                    //cout<<t<<" in 2 connected "<<connectedTo[i][0].ss<<endl;
                }
            }
        }
    }
    if(!foundTwoOnce) {
        ds--;
        dt--;
        bool cool = false;
        fore(i,0,adj[s].sz) {
            if(adj[s][i] == t) {
                cool = true;
            }
        }
        if(cool) {
            grph.pb(mp(s,t));
            //cout<<s<<" between the twi "<<t<<endl;
        }
        else {
            cout<<"No";
            return 0;
        }
    }
    if(dt<0 || ds<0) {
        cout << "No";
        return 0;
    }
    cout<<"Yes"<<endl;
    fore(i,0,n-1) {
        cout<<grph[i].ff + 1<<" "<<grph[i].ss + 1<<endl;
    }
    return 0;
}


#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define pb push_back
#define sz size()
#define ln length()
#define fore(i,a,b) for(int i=a;i<b;i++)
#define fores(i,a,b) for(int i=a;i<=b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define ff first
#define ss second
#define sc(a) scanf("%d",&a)
#define md 1000000007

int n,m;

vector<vi> adj;
vector<pii> grph;
vi vis, component;
int s,t,ds,dt;

void dfs(int i, int k) {
    component[i] = k;
    fore(j,0,adj[i].sz) {
        if(vis[adj[i][j]]) {
            continue;
        }
        if(adj[i][j] == s || adj[i][j] == t) {
            continue;
        }
        vis[adj[i][j]] = 1;
        grph.pb(mp(i,adj[i][j]));
        dfs(adj[i][j], k);
    }
}

inline void input() {
    cin>>n>>m;
    adj.resize(n);
    vis.resize(n);
    component.resize(n);
}
int main() {
    input();
    fore(i,0,m) {
        int u,v;
        cin>>u>>v;
        adj[u-1].pb(v-1);
        adj[v-1].pb(u-1);
    }
    fore(i,0,n) {
        vis[i] = 0;
    }
    cin>>s>>t>>ds>>dt;
    s--;t--;

    int doneComponents = 1;
    fore(i,0,n) {
        if(i == s || i == t) {
            continue;
        }
        if(vis[i] == 0) {
            vis[i] = 1;
            dfs(i, doneComponents);
            doneComponents++;
        }
    }
    vector<vector<pii> > connectedTo(doneComponents-1);
    set<int> added;
    fore(j,0,adj[s].sz) {
        if(vis[adj[s][j]]) {
            if(added.find(component[adj[s][j]] - 1) == added.end()) {
                connectedTo[component[adj[s][j]] - 1].pb(mp(s,adj[s][j]));
                added.insert(component[adj[s][j]] - 1);
            }
        }
    }
    added.clear();
    fore(j,0,adj[t].sz) {
        if(vis[adj[t][j]]) {
            if(added.find(component[adj[t][j]] - 1) == added.end()) {
                connectedTo[component[adj[t][j]] - 1].pb(mp(t,adj[t][j]));
                added.insert(component[adj[t][j]] - 1);
            }
        }
    }
    fore(i,0,doneComponents-1) {
        if(connectedTo[i].sz == 1) {
            if(connectedTo[i][0].ff == s) {
                grph.pb(mp(s,connectedTo[i][0].ss));
                ds--;
            }
            else if(connectedTo[i][0].ff == t){
                grph.pb(mp(t,connectedTo[i][0].ss));
                dt--;
            }
        }
    }
    if(ds<0 || dt<0) {
        cout<<"No";
        return 0;
    }
    bool foundTwoOnce = false;
    fore(i,0,doneComponents-1) {
        if(connectedTo[i].sz == 2) {
            if(!foundTwoOnce) {
                foundTwoOnce = true;
                fore(j,0,2) {
                    if(connectedTo[i][j].ff == s) {
                        grph.pb(mp(s,connectedTo[i][j].ss));
                        ds--;
                    }
                    else if(connectedTo[i][j].ff == t){
                        grph.pb(mp(t,connectedTo[i][j].ss));
                        dt--;
                    }
                }
            }
            else {
                if(ds>0) {
                    ds--;
                    grph.pb(mp(s,connectedTo[i][0].ss));
                }
                else {
                    dt--;
                    grph.pb(mp(t,connectedTo[i][0].ss));
                }
            }
        }
    }
    if(!foundTwoOnce) {
        ds--;
        dt--;
        bool cool = false;
        fore(i,0,adj[s].sz) {
            if(adj[s][i] == t) {
                cool = true;
            }
        }
        if(cool) {
            grph.pb(mp(s,t));
        }
        else {
            cout<<"No";
            return 0;
        }
    }
    if(dt<0 || ds<0) {
        cout << "No";
        return 0;
    }
    cout<<"Yes"<<endl;
    fore(i,0,n-1) {
        cout<<grph[i].ff + 1<<" "<<grph[i].ss + 1<<endl;
    }
    return 0;
}


#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define pb push_back
#define sz size()
#define ln length()
#define fore(i,a,b) for(int i=a;i<b;i++)
#define fores(i,a,b) for(int i=a;i<=b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define ff first
#define ss second
#define sc(a) scanf("%d",&a)
#define md 1000000007

vector<vi> adj;
vector<pii> grph;
vi vis, component;
int s,t,ds,dt;

void dfs(int i, int k) {
    component[i] = k;
    fore(j,0,adj[i].sz) {
        if(vis[adj[i][j]]) {
            continue;
        }
        if(adj[i][j] == s || adj[i][j] == t) {
            continue;
        }
        vis[adj[i][j]] = 1;
        grph.pb(mp(i,adj[i][j]));
        dfs(adj[i][j], k);
    }
}
int main() {
    int n,m;
    cin>>n>>m;
    adj.resize(n);
    vis.resize(n);
    component.resize(n);
    fore(i,0,m) {
        int u,v;
        cin>>u>>v;
        adj[u-1].pb(v-1);
        adj[v-1].pb(u-1);
    }
    fore(i,0,n) {
        vis[i] = 0;
    }
    cin>>s>>t>>ds>>dt;
    s--;t--;

    int doneComponents = 1;
    fore(i,0,n) {
        if(i == s || i == t) {
            continue;
        }
        if(vis[i] == 0) {
            vis[i] = 1;
            dfs(i, doneComponents);
            doneComponents++;
        }
    }
    vector<vector<pii> > connectedTo(doneComponents-1);
    set<int> added;
    fore(j,0,adj[s].sz) {
        if(vis[adj[s][j]]) {
            if(added.find(component[adj[s][j]] - 1) == added.end()) {
                connectedTo[component[adj[s][j]] - 1].pb(mp(s,adj[s][j]));
                added.insert(component[adj[s][j]] - 1);
            }
        }
    }
    added.clear();
    fore(j,0,adj[t].sz) {
        if(vis[adj[t][j]]) {
            if(added.find(component[adj[t][j]] - 1) == added.end()) {
                connectedTo[component[adj[t][j]] - 1].pb(mp(t,adj[t][j]));
                added.insert(component[adj[t][j]] - 1);
            }
        }
    }
    fore(i,0,doneComponents-1) {
        if(connectedTo[i].sz == 1) {
            if(connectedTo[i][0].ff == s) {
                grph.pb(mp(s,connectedTo[i][0].ss));
                ds--;
            }
            else if(connectedTo[i][0].ff == t){
                grph.pb(mp(t,connectedTo[i][0].ss));
                dt--;
            }
        }
    }
    if(ds<0 || dt<0) {
        cout<<"No";
        return 0;
    }
    bool foundTwoOnce = false;
    fore(i,0,doneComponents-1) {
        if(connectedTo[i].sz == 2) {
            if(!foundTwoOnce) {
                foundTwoOnce = true;
                fore(j,0,2) {
                    if(connectedTo[i][j].ff == s) {
                        grph.pb(mp(s,connectedTo[i][j].ss));
                        ds--;
                    }
                    else if(connectedTo[i][j].ff == t){
                        grph.pb(mp(t,connectedTo[i][j].ss));
                        dt--;
                    }
                }
            }
            else {
                if(ds>0) {
                    ds--;
                    grph.pb(mp(s,connectedTo[i][0].ss));
                }
                else {
                    dt--;
                    grph.pb(mp(t,connectedTo[i][0].ss));
                }
            }
        }
    }
    if(!foundTwoOnce) {
        ds--;
        dt--;
        bool cool = false;
        fore(i,0,adj[s].sz) {
            if(adj[s][i] == t) {
                cool = true;
            }
        }
        if(cool) {
            grph.pb(mp(s,t));
        }
        else {
            cout<<"No";
            return 0;
        }
    }
    if(dt<0 || ds<0) {
        cout << "No";
        return 0;
    }
    cout<<"Yes"<<endl;
    fore(i,0,n-1) {
        cout<<grph[i].ff + 1<<" "<<grph[i].ss + 1<<endl;
    }
    return 0;
}


#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define pb push_back
#define sz size()
#define ln length()
#define fore(i,a,b) for(int i=a;i<b;i++)
#define fores(i,a,b) for(int i=a;i<=b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define ff first
#define ss second
#define sc(a) scanf("%d",&a)
#define md 1000000007

vector<vi> adj;
vector<pii> grph;
vi vis, component;
int s,t;

void dfs(int i, int k) {
    component[i] = k;
    fore(j,0,adj[i].sz) {
        if(vis[adj[i][j]]) {
            continue;
        }
        if(adj[i][j] == s || adj[i][j] == t) {
        	continue;
        }
        vis[adj[i][j]] = 1;
        grph.pb(mp(i,adj[i][j]));
        dfs(adj[i][j], k);
    }
}
int main() {
    int n,m;
    cin>>n>>m;
    adj.resize(n);
    vis.resize(n);
    component.resize(n);
    fore(i,0,n) {
        int u,v;
        cin>>u>>v;
        adj[u-1].pb(v-1);
        adj[v-1].pb(u-1);
    }
    fore(i,0,n) {
        vis[i] = 0;
    }
    int ds,dt;
    cin>>s>>t>>ds>>dt;
    s--;t--;

    int doneComponents = 1;
    fore(i,0,n) {
        if(i == s || i == t) {
            continue;
        }
        if(vis[i] == 0) {
        	vis[i] = 1;
            dfs(i, doneComponents);
            doneComponents++;
        }
    }
    vector<vector<pii> > connectedTo(doneComponents-1);
    fore(j,0,adj[s].sz) {
        if(vis[adj[s][j]]) {
            connectedTo[component[adj[s][j]] - 1].pb(mp(s,adj[s][j]));
        }
    }
    fore(j,0,adj[t].sz) {
        if(vis[adj[t][j]]) {
            connectedTo[component[adj[t][j]] - 1].pb(mp(t,adj[t][j]));
        }
    }
    fore(i,0,doneComponents-1) {
    	//cout<<connectedTo[i].sz<<endl;
        if(connectedTo[i].sz == 1) {
            if(connectedTo[i][0].ff == s) {
                grph.pb(mp(s,connectedTo[i][0].ss));
                ds--;
            }
            else {
                grph.pb(mp(t,connectedTo[i][0].ss));
                dt--;
            }
        }
    }
    if(ds<0 || dt<0) {
        cout<<"No";
        return 0;
    }
    bool foundTwoOnce = false;
    fore(i,0,doneComponents-1) {
        if(connectedTo[i].sz == 2) {
            if(!foundTwoOnce) {
                foundTwoOnce = true;
                //cout<<"here"<<endl;
                grph.pb(mp(s,connectedTo[i][0].ss));
                grph.pb(mp(t,connectedTo[i][0].ss));
                ds--;
                dt--;
            }
            else {
                if(ds>0) {
                    ds--;
                    grph.pb(mp(s,connectedTo[i][0].ss));
                }
                else {
                    dt--;
                    grph.pb(mp(t,connectedTo[i][0].ss));
                }
            }
        }
    }
    if(!foundTwoOnce) {
        ds--;
        dt--;
        grph.pb(mp(s,t));
    }
    if(dt<0 || ds<0) {
        cout << "No";
        return 0;
    }
    cout<<"Yes"<<endl;
    fore(i,0,n-1) {
        cout<<grph[i].ff + 1<<" "<<grph[i].ss + 1<<endl;
    }
    return 0;
}


#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair < int, int > ii;

const int N = 2e5 + 5;

int n, m, s, t, ds, dt;
int root[N], cs[N], ct[N];
ii ed[N];
vector < ii > ans;

int f(int x) {
    return root[x] = x == root[x] ? x : f(root[x]);
}

void merge(int x, int y) {
    ans.push_back({x, y});
    x = f(x);
    y = f(y);
    root[y] = x;
    if(cs[y]) cs[x] = cs[y];
    if(ct[y]) ct[x] = ct[y];
}

int main() {

    scanf("%d %d", &n, &m);

    for(int i = 1; i <= n; i++)
        root[i] = i;

    for(int i = 1; i <= m; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        ed[i] = {x, y};
    }

    scanf("%d %d %d %d", &s, &t, &ds, &dt);

    for(int i = 1; i <= m; i++) {
        int x, y;
        tie(x, y) = ed[i];
        if(x == s) cs[y] = y;
        if(x == t) ct[y] = y;
        if(y == s) cs[x] = x;
        if(y == t) ct[x] = x;
    }

    for(int i = 1; i <= m; i++) {
        int x, y;
        tie(x, y) = ed[i];
        if(x != s and x != t and y != s and y != t and f(y) != f(x)) {
            merge(x, y);
        }
    }

    vector < int > both;

    for(int i = 1; i <= n; i++) {
        if(i == s or i == t or i != f(i))
            continue;
        if(!cs[i] and !ct[i]) {
            puts("No");
            return 0;
        }
        if(cs[i] and ct[i]) {
            both.push_back(i);
        }
        else if(cs[i]) {
            ans.push_back({cs[i], s});
            ds--;
        }
        else {
            ans.push_back({ct[i], t});
            dt--;
        }
    }

    if(both.empty()) {
        if(ct[s]) {
            ans.push_back({s, t});
            ds--;
            dt--;
        }
        else {
            puts("No");
            return 0;
        }
    }
    else {
        ans.push_back({s, cs[both.back()]});
        ans.push_back({t, ct[both.back()]});
        ds--;
        dt--;
        both.pop_back();
    }

    for(auto x : both) {
        if(ds > 0) {
            ans.push_back({cs[x], s});
            ds--;
        }
        else {
            ans.push_back({ct[x], t});
            dt--;
        }
    }

    if(ds < 0 or dt < 0) {
        puts("No");
        return 0;
    }

    puts("Yes");

    for(auto x : ans) {
        printf("%d %d\n", x.first, x.second);
    }

    return 0;

}