#include #include using namespace std; using namespace atcoder; int main() { int N,M; cin>>N>>M; vector d(N); mf_graph gr(N+2); for(int i=0; i>U>>V; d[U-1]+=1; d[V-1]-=1; gr.add_edge(U-1,V-1,1); } for(int i=0; i> ans(0); cerr<::edge i:gr.edges()){ if(i.flow==0 or i.from==N or i.to==N+1){ continue; } ans.push_back(make_pair(i.from+1,i.to+1)); } printf("%d %d\n",N,(int)ans.size()); for(pair i: ans){ printf("%d %d\n",i.first,i.second); } }