// File: shininglion[P]find_max_independent_set/main.cpp
// Function: main
int main(const int argc, const char* argv[])
{
    using namespace std;
	
    if (freopen(argv[1],"r",stdin) == nullptr) {
		fprintf(stderr, "Cannot open file %s\n", argv[1]);
		return 0;
	}

#ifdef TEST_USE_NODE
    vector<Node> connect;
#else
    vector< vector<int> > connect;
#endif
    vector<int> set;

    int Vnum, Enum;
	bool fail_flag = false;
    while(scanf("%d %d", &Vnum, &Enum) == 2) {
        connect.resize(Vnum);
#ifdef TEST_USE_NODE
        for (auto& node : connect) { node.edge_list.reserve(Vnum); }
#else
        for (auto& node : connect) { node.reserve(Vnum); }
#endif

#ifdef TEST_COST
		for (int i = 0; (i < Vnum) && (!fail_flag); ++i) {
			double cost = 0;
			if (scanf("%lf", &cost) != 1) { fail_flag = true; break; }
			connect[i].cost = cost;
		}
#endif

        // set the edge connection by (a b) for convenience
        for(int i = 0; (i < Enum) && (!fail_flag); ++i){
			int from, to;
            if (scanf("%d %d", &from, &to) != 2) { fail_flag = true; break; }
            // set index start from 0
            --from;
            --to;
#ifdef TEST_USE_NODE
            connect[from].edge_list.push_back(to);
            connect[to].edge_list.push_back(from);
#else
            connect[from].push_back(to);
            connect[to].push_back(from);
#endif
        }
		if (fail_flag) {
			fail_flag = false;
			fprintf(stderr, "An incomplete input.\n");
			continue;
		}

#ifdef TEST_USE_NODE
#ifdef TEST_COST
#ifndef USE_NAIVE
		printf("use greedy heuristic...\n");
        const double cost = graph::findMinCostMIS(connect, set, [](const Node& node) -> const std::vector<int>& { return node.edge_list; }, [](const Node& node) -> double { return node.cost; } );
#else
		printf("use naive approach...\n");
        const double cost = graph::naiveMinCostMIS(connect, set, [](const Node& node) -> const std::vector<int>& { return node.edge_list; }, [](const Node& node) -> double { return node.cost; } );
#endif
#else
#ifndef USE_NAIVE
		graph::findMIS(connect, set, [](const Node& node) -> const std::vector<int>& { return node.edge_list; });
#else
		graph::naiveMIS(connect, set, [](const Node& node) -> const std::vector<int>& { return node.edge_list; });
#endif
#endif
#else
#ifndef USE_NAIVE
		graph::findMIS(connect, set);
#else
		graph::naiveMIS(connect, set);
#endif
#endif

		printf("Validate mis...");
#ifdef TEST_USE_NODE
		const bool legal = graph::validateMIS(connect, set, [](const Node& node) -> const std::vector<int>& { return node.edge_list; });
#else
		const bool legal = graph::validateMIS(connect, set);
#endif
		printf(legal ? "pass\n" : "fail\n");

#ifdef TEST_COST
        printf("Maximum independent set (MIS) size and cost: %lu, %.3lf\n", set.size(), cost);
#else
        printf("Maximum independent set (MIS) size: %lu\n", set.size());
#endif
		printf("MIS vertices: ");
        for(size_t j = 0; j < set.size(); ++j )
            printf(" %d", set[j] + 1);
		putchar('\n');
    }
    return 0;
}

// Assembly:
subq $0xf8, %rsp
movl $0x0, 0xf4(%rsp)
movl %edi, 0xf0(%rsp)
movq %rsi, 0xe8(%rsp)
movq 0xe8(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0xaccc(%rip), %rax      # 0xbfd0
movq (%rax), %rdx
leaq 0x5db1(%rip), %rsi      # 0x70bf
callq 0x10f0
cmpq $0x0, %rax
jne 0x134d
movq 0xacb8(%rip), %rax      # 0xbfd8
movq (%rax), %rdi
movq 0xe8(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0x5d8b(%rip), %rsi      # 0x70c1
movb $0x0, %al
callq 0x1130
movl $0x0, 0xf4(%rsp)
jmp 0x178c
leaq 0xd0(%rsp), %rdi
callq 0x2590
leaq 0xb8(%rsp), %rdi
callq 0x25a0
movb $0x0, 0xaf(%rsp)
leaq 0x5d60(%rip), %rdi      # 0x70d6
xorl %eax, %eax
leaq 0xb4(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
callq 0x1100
movl %eax, 0x3c(%rsp)
jmp 0x1393
movl 0x3c(%rsp), %eax
cmpl $0x2, %eax
jne 0x1767
movslq 0xb4(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
callq 0x25b0
jmp 0x13b7
leaq 0xd0(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rdi
callq 0x2650
movq %rax, 0x88(%rsp)
movq 0x90(%rsp), %rdi
callq 0x2680
movq %rax, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x26b0
testb $0x1, %al
jne 0x140c
jmp 0x147a
leaq 0x88(%rsp), %rdi
callq 0x26f0
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rdi
addq $0x8, %rdi
movslq 0xb4(%rsp), %rsi
callq 0x2700
jmp 0x1436
jmp 0x1438
leaq 0x88(%rsp), %rdi
callq 0x2810
jmp 0x13f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa0(%rsp)
movl %eax, 0x9c(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x2900
leaq 0xd0(%rsp), %rdi
callq 0x2960
jmp 0x179b
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %ecx
xorl %eax, %eax
cmpl 0xb4(%rsp), %ecx
movb %al, 0x3b(%rsp)
jge 0x14a2
movb 0xaf(%rsp), %al
xorb $-0x1, %al
movb %al, 0x3b(%rsp)
movb 0x3b(%rsp), %al
testb $0x1, %al
jne 0x14ac
jmp 0x1519
movq $0x0, 0x68(%rsp)
leaq 0x5c20(%rip), %rdi      # 0x70dc
xorl %eax, %eax
leaq 0x68(%rsp), %rsi
callq 0x1100
movl %eax, 0x34(%rsp)
jmp 0x14ce
movl 0x34(%rsp), %eax
cmpl $0x1, %eax
je 0x14e1
movb $0x1, 0xaf(%rsp)
jmp 0x1519
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movslq 0x74(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
callq 0x2830
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x1482
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %ecx
xorl %eax, %eax
cmpl 0xb0(%rsp), %ecx
movb %al, 0x27(%rsp)
jge 0x1541
movb 0xaf(%rsp), %al
xorb $-0x1, %al
movb %al, 0x27(%rsp)
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x154e
jmp 0x15ef
leaq 0x5b81(%rip), %rdi      # 0x70d6
xorl %eax, %eax
leaq 0x60(%rsp), %rsi
leaq 0x5c(%rsp), %rdx
callq 0x1100
movl %eax, 0x20(%rsp)
jmp 0x156c
movl 0x20(%rsp), %eax
cmpl $0x2, %eax
je 0x157f
movb $0x1, 0xaf(%rsp)
jmp 0x15ef
movl 0x60(%rsp), %eax
decl %eax
movl %eax, 0x60(%rsp)
movl 0x5c(%rsp), %eax
decl %eax
movl %eax, 0x5c(%rsp)
movslq 0x60(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
callq 0x2830
movq %rax, %rdi
addq $0x8, %rdi
leaq 0x5c(%rsp), %rsi
callq 0x2850
jmp 0x15b8
movslq 0x5c(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
callq 0x2830
movq %rax, %rdi
addq $0x8, %rdi
leaq 0x60(%rsp), %rsi
callq 0x2850
jmp 0x15dd
jmp 0x15df
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x1521
testb $0x1, 0xaf(%rsp)
je 0x161e
movb $0x0, 0xaf(%rsp)
movq 0xa9d0(%rip), %rax      # 0xbfd8
movq (%rax), %rdi
leaq 0x5ace(%rip), %rsi      # 0x70e0
movb $0x0, %al
callq 0x1130
jmp 0x136f
leaq 0x5ad1(%rip), %rdi      # 0x70f6
xorl %eax, %eax
callq 0x1030
jmp 0x162e
leaq 0xd0(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x17b0
movsd %xmm0, 0x18(%rsp)
jmp 0x164b
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
leaq 0x5aaf(%rip), %rdi      # 0x710d
xorl %eax, %eax
callq 0x1030
jmp 0x1667
leaq 0xd0(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x1b20
movb %al, 0x17(%rsp)
jmp 0x1682
movb 0x17(%rsp), %al
andb $0x1, %al
movb %al, 0x4d(%rsp)
testb $0x1, 0x4d(%rsp)
je 0x16a1
leaq 0x5a83(%rip), %rax      # 0x711d
movq %rax, 0x8(%rsp)
jmp 0x16af
leaq 0x5a7b(%rip), %rax      # 0x7123
movq %rax, 0x8(%rsp)
jmp 0x16af
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x1030
jmp 0x16bd
leaq 0xb8(%rsp), %rdi
callq 0x28c0
movq %rax, %rsi
movsd 0x50(%rsp), %xmm0
leaq 0x5a4f(%rip), %rdi      # 0x7129
movb $0x1, %al
callq 0x1030
jmp 0x16e3
leaq 0x5a78(%rip), %rdi      # 0x7162
xorl %eax, %eax
callq 0x1030
jmp 0x16f3
movq $0x0, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq %rax, (%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x28c0
movq %rax, %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
jae 0x1756
movq 0x40(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x28e0
movl (%rax), %esi
incl %esi
leaq 0x599d(%rip), %rdi      # 0x70d8
xorl %eax, %eax
callq 0x1030
jmp 0x1744
jmp 0x1746
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x16fc
movl $0xa, %edi
callq 0x1120
jmp 0x1762
jmp 0x136f
movl $0x0, 0xf4(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x2900
leaq 0xd0(%rsp), %rdi
callq 0x2960
movl 0xf4(%rsp), %eax
addq $0xf8, %rsp
retq
movq 0xa0(%rsp), %rdi
callq 0x1180
nopl (%rax,%rax)