#include <stdio.h>
#include <malloc.h>
#define FIN "sortaret.in"
#define FOUT "sortaret.out"
#define MAX 500001
struct Node {
int info;
struct Node *next;
};
int num_nodes, num_edges, visited[MAX];
struct Node *G[ MAX ], *head = NULL;
void dfs(int node) {
struct Node *c, *p;
visited[ node ] = 1;
for(c = G[node]; c; c=c->next) {
if(!visited[c->info]) {
dfs(c->info);
}
}
p
= (struct Node
*)malloc(sizeof(struct Node
)); p->info = node;
p->next = head;
head = p;
}
int main(int argc, char const *argv[]) {
int i, j;
struct Node *c;
//freopen(FIN, "r", stdin);
//freopen(FOUT, "w", stdout);
scanf("%d %d", &num_nodes
, &num_edges
);
while(num_edges--) {
c
= (struct Node
*)malloc(sizeof(struct Node
)); c->info = j;
c->next = G[ i ];
G[ i ] = c;
}
for(int node = 1; node <= num_nodes; ++node) {
if(!visited[node]) {
dfs(node);
}
}
for(c = head; c; c = c->next) {
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYWxsb2MuaD4KI2RlZmluZSBGSU4gInNvcnRhcmV0LmluIgojZGVmaW5lIEZPVVQgInNvcnRhcmV0Lm91dCIKI2RlZmluZSBNQVggNTAwMDAxCgpzdHJ1Y3QgTm9kZSB7CgogICAgICAgaW50IGluZm87CiAgICAgICBzdHJ1Y3QgTm9kZSAqbmV4dDsKfTsKCmludCBudW1fbm9kZXMsIG51bV9lZGdlcywgdmlzaXRlZFtNQVhdOwoKc3RydWN0IE5vZGUgKkdbIE1BWCBdLCAqaGVhZCA9IE5VTEw7Cgp2b2lkIGRmcyhpbnQgbm9kZSkgewoKICAgICAgIHN0cnVjdCBOb2RlICpjLCAqcDsKCiAgICAgICB2aXNpdGVkWyBub2RlIF0gPSAxOwoKICAgICAgIGZvcihjID0gR1tub2RlXTsgYzsgYz1jLT5uZXh0KSB7CgogICAgICAgICAgIGlmKCF2aXNpdGVkW2MtPmluZm9dKSB7CgogICAgICAgICAgICAgZGZzKGMtPmluZm8pOwogICAgICAgICAgIH0KICAgICAgIH0KCiAgICAgICBwID0gKHN0cnVjdCBOb2RlKiltYWxsb2Moc2l6ZW9mKHN0cnVjdCBOb2RlKSk7CiAgICAgICBwLT5pbmZvID0gbm9kZTsKICAgICAgIHAtPm5leHQgPSBoZWFkOwogICAgICAgaGVhZCA9IHA7Cn0KCmludCBtYWluKGludCBhcmdjLCBjaGFyIGNvbnN0ICphcmd2W10pIHsKCiAgICBpbnQgaSwgajsKICAgIHN0cnVjdCBOb2RlICpjOwoKICAgIC8vZnJlb3BlbihGSU4sICJyIiwgc3RkaW4pOwoKICAgIC8vZnJlb3BlbihGT1VULCAidyIsIHN0ZG91dCk7CgogICAgc2NhbmYoIiVkICVkIiwgJm51bV9ub2RlcywgJm51bV9lZGdlcyk7CgogICAgd2hpbGUobnVtX2VkZ2VzLS0pIHsKCiAgICAgICAgICBzY2FuZigiJWQgJWQiLCAmaSwgJmopOwogICAgICAgICAgYyA9IChzdHJ1Y3QgTm9kZSopbWFsbG9jKHNpemVvZihzdHJ1Y3QgTm9kZSkpOwogICAgICAgICAgYy0+aW5mbyA9IGo7CiAgICAgICAgICBjLT5uZXh0ID0gR1sgaSBdOwogICAgICAgICAgR1sgaSBdID0gYzsKICAgIH0KCiAgICBmb3IoaW50IG5vZGUgPSAxOyBub2RlIDw9IG51bV9ub2RlczsgKytub2RlKSB7CgogICAgICAgICAgICAgaWYoIXZpc2l0ZWRbbm9kZV0pIHsKCiAgICAgICAgICAgICAgICAgZGZzKG5vZGUpOwogICAgICAgICAgICAgfQogICAgfQoKICAgIGZvcihjID0gaGVhZDsgYzsgYyA9IGMtPm5leHQpIHsKCiAgICAgICAgcHJpbnRmKCIlZCAiLCBjLT5pbmZvKTsKICAgIH0KICByZXR1cm4gMDsKfQo=