#include<fstream.h> fstream f("date.in",ios::in); fstream g("date.out",ios::out); int n,m,a[100],b[100]; void citire() { int x,y,i; f>>n>>m; for(i=1;i<=m;i++) { f>>x>>y; a[x]++; b[y]++; } } void main() { citire(); int i; for(i=1;i<=n;i++) if(a[i]==b[i]) g<<i<<" "; }