#include using namespace std; namespace io { constexpr int S1=1<<20; char buf1[S1],*l1,*r1; inline char getc() { return ((l1==r1&&(r1=(l1=buf1)+fread(buf1,1,S1,stdin)),l1!=r1)?*l1++:EOF); } templateinline T read() { T x=0,y=1; char c=getc(); for(;c<'0'||c>'9';c=getc()) if(c=='-') y=-1; for(;c>='0'&&c<='9';c=getc()) x=c-'0'+x*10; return x*y; } constexpr int S2=1<<20; char buf2[S2],*l2=buf2; inline void putc(char c) { l2==buf2+S2&&(fwrite(buf2,1,S2,stdout),l2=buf2),*l2++=c; } int st[42]; templateinline void write(T x,char end='\n') { if(x<0) putc('-'),x=-x; int tp=0; do st[++tp]=x%10; while(x/=10); while(tp) putc(st[tp--]+'0'); if(end) putc(end); } inline void ps(const char*a,char end='\n') { for(const char*p=a;*p;p++) putc(*p); if(end) putc(end); } struct end { ~end() { fwrite(buf2,1,l2-buf2,stdout); } }ender; } using io::getc; using io::read; using io::putc; using io::write; using io::ps; constexpr long long mod=1000000007; constexpr int MN=100005; int n,m; long long v; paira[MN]; inline long long ksm(long long b,int p) { long long res=1; for(;p;p>>=1) { if(p&1) res=res*b%mod; b=b*b%mod; } return res; } inline void work() { n=read(),m=read(),v=read(); for(int i=1;i<=m;i++) a[i].first=read(),a[i].second=read(); sort(a+1,a+m+1); for(int i=1;i