#include #include inline int read() { short f=1;int x=0; char c=getchar(); while(c<'0'||c>'9') {if(c=='-')f=-1;c=getchar();} while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar(); return x*f; } typedef long long ll; const int N=1e5+10,MOD=1e9+7; int n,m,v; struct zzn{int x,w;}a[N]; inline int qpow(ll x,int y) { int res=1; while(y) { if(y&1) res=x*res%MOD; x=x*x%MOD;y>>=1; } return res; } inline int sub(const int &x,const int &y){return x-y<0?x-y+MOD:x-y;} int cnt; inline void solve() { n=read(),m=read(),v=read(); for(int i=1;i<=m;i=-~i) a[i]={read(),read()}; std::sort(a+1,a+m+1,[&](const zzn &x,const zzn &y){return x.x