Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#include<stdlib.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++) //単純なループの簡略化
typedef struct{int *A,size,maxsize;}vector; //疑似的な可変長配列

vector edge[100050]; //辺の情報を保持
int color[100050]; //頂点の色の情報を保持
int reached[100050]; //最大残り距離いくつでその頂点に到達したことがあるかを保持、ただし-1の時未到達を意味する

void push_back(int v,int push){ //vectorのpush_back機能
    if(edge[v].size==0){
        edge[v].size++;
        edge[v].maxsize++;
        edge[v].A=(int*)malloc(sizeof(int));
        edge[v].A[0]=push;
    }
    else{
        edge[v].size++;
        if(edge[v].size>edge[v].maxsize){ //可変長配列の長さが足りなくなった場合、元の2倍の大きさの領域を再確保
            edge[v].maxsize*=2;
            edge[v].A=(int*)realloc(edge[v].A,sizeof(int)*edge[v].maxsize);
        }
        edge[v].A[edge[v].size-1]=push;
    }
}

void DFS(int V,int dis,int paint){ //入力されたグラフ上での枝狩り深さ優先探索
    if(reached[V]>=dis) return; //到達時の残り距離が以前到達したときより短いなら打ち切る
    reached[V]=dis; //到達時の残り距離を更新
    if(color[V]==0) color[V]=paint; //まだ塗られていない場合、色を塗る
    rep(i,edge[V].size) DFS(edge[V].A[i],dis-1,paint); //隣接している全ての頂点へ移動する
}

int main(void){
    int N,M;
    scanf("%d",&N); //頂点数の入力
    scanf("%d",&M); //辺の数の入力
    rep(i,N) reached[i]=-1; //全ての頂点を未到達を意味する-1で初期化
    rep(i,M){ //辺の情報の入力
        int a,b;
        scanf("%d%d",&a,&b);
        a--,b--; // 0-indexedに直す
        push_back(a,b); //双方向に辺を張る
        push_back(b,a);
    }
    int Q;
    scanf("%d",&Q); //操作の回数の入力
    if(Q<1 || Q>100000) error();
    int V[Q],D[Q],C[Q];
    rep(i,Q){ //操作の入力
        scanf("%d%d%d",&V[i],&D[i],&C[i]);
        V[i]--; // 0-indexedに直す
    }
    for(int i=Q-1;i>=0;i--) DFS(V[i],D[i],C[i]); //枝狩り深さ優先探索を入力の逆順に実行
    rep(i,N) printf("%d\n",color[i]); //結果の出力
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	edge
	.bss
	.align 32
	.type	edge, @object
	.size	edge, 1600800
edge:
	.zero	1600800
	.globl	color
	.align 32
	.type	color, @object
	.size	color, 400200
color:
	.zero	400200
	.globl	reached
	.align 32
	.type	reached, @object
	.size	reached, 400200
reached:
	.zero	400200
	.text
	.globl	push_back
	.type	push_back, @function
push_back:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	$4, %edi
	call	malloc@PLT
	movq	%rax, %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	edge(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	edge(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-8(%rbp), %edx
	movl	%edx, (%rax)
	jmp	.L5
.L2:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	12+edge(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rax,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	edge(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	realloc@PLT
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	edge(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L4:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	edge(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
.L5:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	push_back, .-push_back
	.globl	DFS
	.type	DFS, @function
DFS:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	reached(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L12
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	reached(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	color(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L9
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	color(%rip), %rdx
	movl	-28(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L9:
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-24(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	edge(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-28(%rbp), %edx
	movl	%ecx, %esi
	movl	%eax, %edi
	call	DFS
	addl	$1, -4(%rbp)
.L10:
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	jmp	.L6
.L12:
	nop
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	DFS, .-DFS
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$168, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-140(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -124(%rbp)
	jmp	.L14
.L15:
	movl	-124(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	reached(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -124(%rbp)
.L14:
	movl	-140(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L15
	movl	$0, -120(%rbp)
	jmp	.L16
.L17:
	leaq	-128(%rbp), %rax
	leaq	-132(%rbp), %rcx
	movq	%rax, %rdx
	movq	%rcx, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-132(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -132(%rbp)
	movl	-128(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -128(%rbp)
	movl	-128(%rbp), %eax
	movl	-132(%rbp), %edx
	movl	%eax, %esi
	movl	%edx, %edi
	call	push_back
	movl	-132(%rbp), %eax
	movl	-128(%rbp), %edx
	movl	%eax, %esi
	movl	%edx, %edi
	call	push_back
	addl	$1, -120(%rbp)
.L16:
	movl	-136(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L17
	leaq	-128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-128(%rbp), %eax
	testl	%eax, %eax
	jle	.L18
	movl	-128(%rbp), %eax
	cmpl	$100000, %eax
	jle	.L19
.L18:
	movl	$0, %eax
	call	error@PLT
.L19:
	movl	-128(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%edx, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movslq	%edx, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L20:
	cmpq	%rdx, %rsp
	je	.L21
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L20
.L21:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L22
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L22:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -208(%rbp)
	movq	$0, -200(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L23:
	cmpq	%rdx, %rsp
	je	.L24
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L23
.L24:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L25
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L25:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L26:
	cmpq	%rdx, %rsp
	je	.L27
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L26
.L27:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L28
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L28:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -116(%rbp)
	jmp	.L29
.L30:
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rax, %rdx
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-96(%rbp), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-96(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %ecx
	movq	-96(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -116(%rbp)
.L29:
	movl	-128(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L30
	movl	-128(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -112(%rbp)
	jmp	.L31
.L32:
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	-80(%rbp), %rax
	movl	-112(%rbp), %ecx
	movslq	%ecx, %rcx
	movl	(%rax,%rcx,4), %ecx
	movq	-96(%rbp), %rax
	movl	-112(%rbp), %esi
	movslq	%esi, %rsi
	movl	(%rax,%rsi,4), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	DFS
	subl	$1, -112(%rbp)
.L31:
	cmpl	$0, -112(%rbp)
	jns	.L32
	movl	$0, -108(%rbp)
	jmp	.L33
.L34:
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	color(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -108(%rbp)
.L33:
	movl	-140(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L34
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L36
	call	__stack_chk_fail@PLT
.L36:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.type	DFS.part.0, @function
DFS.part.0:
.LFB43:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rax
	leaq	color(%rip), %r10
	leaq	reached(%rip), %r9
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movl	(%r10,%rax,4), %r12d
	movl	%esi, (%r9,%rax,4)
	movl	%esi, 64(%rsp)
	movl	%edx, 48(%rsp)
	testl	%r12d, %r12d
	jne	.L2
	movl	%edx, (%r10,%rax,4)
.L2:
	leaq	edge(%rip), %rcx
	salq	$4, %rax
	addq	%rcx, %rax
	movl	8(%rax), %ecx
	movq	%rax, 80(%rsp)
	testl	%ecx, %ecx
	jle	.L1
	movl	64(%rsp), %ebx
	movq	(%rax), %rax
	movq	$0, 32(%rsp)
	movq	%rax, 72(%rsp)
	leal	-2(%rbx), %eax
	leal	-1(%rbx), %edi
	movl	%eax, 52(%rsp)
	leal	-3(%rbx), %eax
	movl	%edi, 68(%rsp)
	movl	%eax, 88(%rsp)
.L19:
	movq	72(%rsp), %rax
	movq	32(%rsp), %rsi
	movl	68(%rsp), %edi
	movslq	(%rax,%rsi,4), %rax
	cmpl	%edi, (%r9,%rax,4)
	jge	.L4
	movl	(%r10,%rax,4), %ebp
	movl	%edi, (%r9,%rax,4)
	testl	%ebp, %ebp
	jne	.L5
	movl	48(%rsp), %esi
	movl	%esi, (%r10,%rax,4)
.L5:
	leaq	edge(%rip), %rdx
	salq	$4, %rax
	addq	%rdx, %rax
	movl	8(%rax), %edx
	movq	%rax, 56(%rsp)
	testl	%edx, %edx
	jle	.L4
	movq	(%rax), %rax
	movl	88(%rsp), %ecx
	movq	$0, 8(%rsp)
	movq	%rax, 40(%rsp)
	movl	64(%rsp), %eax
	leal	-4(%rax), %r8d
.L18:
	movq	8(%rsp), %rsi
	movq	40(%rsp), %rax
	movslq	(%rax,%rsi,4), %rax
	movl	52(%rsp), %esi
	cmpl	%esi, (%r9,%rax,4)
	jge	.L6
	movl	(%r10,%rax,4), %ebx
	movl	%esi, (%r9,%rax,4)
	testl	%ebx, %ebx
	jne	.L7
	movl	48(%rsp), %edi
	movl	%edi, (%r10,%rax,4)
.L7:
	salq	$4, %rax
	leaq	edge(%rip), %rsi
	addq	%rax, %rsi
	movl	8(%rsi), %eax
	movq	%rsi, 24(%rsp)
	testl	%eax, %eax
	jle	.L6
	movq	(%rsi), %rsi
	movl	64(%rsp), %edx
	xorl	%r15d, %r15d
	movq	%rsi, 16(%rsp)
	leal	-5(%rdx), %esi
.L17:
	movq	16(%rsp), %rdx
	movslq	(%rdx,%r15,4), %r13
	cmpl	%ecx, (%r9,%r13,4)
	jge	.L8
	movl	(%r10,%r13,4), %r11d
	movl	%ecx, (%r9,%r13,4)
	testl	%r11d, %r11d
	jne	.L9
	movl	48(%rsp), %edx
	movl	%edx, (%r10,%r13,4)
.L9:
	salq	$4, %r13
	leaq	edge(%rip), %rbx
	addq	%rbx, %r13
	movl	8(%r13), %edx
	testl	%edx, %edx
	jle	.L8
	movq	0(%r13), %rax
	xorl	%r12d, %r12d
.L16:
	movslq	(%rax,%r12,4), %rbp
	cmpl	%r8d, (%r9,%rbp,4)
	jge	.L10
	movl	(%r10,%rbp,4), %edi
	movl	%r8d, (%r9,%rbp,4)
	testl	%edi, %edi
	jne	.L11
	movl	48(%rsp), %edi
	movl	%edi, (%r10,%rbp,4)
.L11:
	salq	$4, %rbp
	leaq	edge(%rip), %rdi
	addq	%rbp, %rdi
	movl	8(%rdi), %r11d
	testl	%r11d, %r11d
	jle	.L10
	movq	(%rdi), %r14
	xorl	%ebx, %ebx
.L15:
	movslq	(%r14,%rbx,4), %rdx
	movq	%rdx, %rdi
	cmpl	%esi, (%r9,%rdx,4)
	jge	.L12
	movl	48(%rsp), %edx
	movl	%ecx, 108(%rsp)
	addq	$1, %rbx
	movl	%r8d, 104(%rsp)
	movq	%rax, 96(%rsp)
	movl	%esi, 92(%rsp)
	call	DFS.part.0
	leaq	edge(%rip), %rax
	movl	92(%rsp), %esi
	movl	104(%rsp), %r8d
	movl	8(%rax,%rbp), %r11d
	movl	108(%rsp), %ecx
	leaq	reached(%rip), %r9
	leaq	color(%rip), %r10
	movq	96(%rsp), %rax
	cmpl	%ebx, %r11d
	jg	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movl	8(%r13), %edx
.L10:
	addq	$1, %r12
	cmpl	%r12d, %edx
	jg	.L16
	movq	24(%rsp), %rax
	movl	8(%rax), %eax
.L8:
	addq	$1, %r15
	cmpl	%r15d, %eax
	jg	.L17
	movq	56(%rsp), %rax
	movl	8(%rax), %edx
.L6:
	addq	$1, 8(%rsp)
	movq	8(%rsp), %rax
	cmpl	%eax, %edx
	jg	.L18
	movq	80(%rsp), %rax
	movl	8(%rax), %ecx
.L4:
	addq	$1, 32(%rsp)
	movq	32(%rsp), %rax
	cmpl	%eax, %ecx
	jg	.L19
.L1:
	addq	$120, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L12:
	.cfi_restore_state
	addq	$1, %rbx
	cmpl	%ebx, %r11d
	jg	.L15
	jmp	.L14
	.cfi_endproc
.LFE43:
	.size	DFS.part.0, .-DFS.part.0
	.p2align 4
	.globl	push_back
	.type	push_back, @function
push_back:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movslq	%edi, %rdi
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	salq	$4, %rdi
	leaq	edge(%rip), %rbx
	addq	%rdi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movl	8(%rbx), %edx
	testl	%edx, %edx
	je	.L33
	movl	12(%rbx), %eax
	addl	$1, %edx
	movl	%edx, 8(%rbx)
	cmpl	%eax, %edx
	jg	.L30
	movq	(%rbx), %rax
.L31:
	movslq	%edx, %rdx
	movl	%ebp, -4(%rax,%rdx,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L30:
	.cfi_restore_state
	addl	%eax, %eax
	movq	(%rbx), %rdi
	movl	%eax, 12(%rbx)
	cltq
	leaq	0(,%rax,4), %rsi
	call	realloc@PLT
	movl	8(%rbx), %edx
	movq	%rax, (%rbx)
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L33:
	addl	$1, 12(%rbx)
	movl	$4, %edi
	movl	$1, 8(%rbx)
	call	malloc@PLT
	movq	%rax, (%rbx)
	movl	%ebp, (%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE39:
	.size	push_back, .-push_back
	.p2align 4
	.globl	DFS
	.type	DFS, @function
DFS:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rdi
	leaq	reached(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	cmpl	%esi, (%r15,%rdi,4)
	jge	.L34
	leaq	color(%rip), %rax
	movl	%esi, (%r15,%rdi,4)
	movl	(%rax,%rdi,4), %ecx
	testl	%ecx, %ecx
	je	.L42
.L36:
	salq	$4, %rdi
	leaq	edge(%rip), %r13
	leaq	0(%r13,%rdi), %rcx
	movq	%rdi, %r12
	movl	8(%rcx), %eax
	testl	%eax, %eax
	jle	.L34
	movq	(%rcx), %r14
	leal	-1(%rsi), %ebp
	xorl	%ebx, %ebx
.L40:
	movslq	(%r14,%rbx,4), %rcx
	movq	%rcx, %rdi
	cmpl	%ebp, (%r15,%rcx,4)
	jge	.L38
	movl	%ebp, %esi
	movl	%edx, 12(%rsp)
	addq	$1, %rbx
	call	DFS.part.0
	movl	8(%r13,%r12), %eax
	movl	12(%rsp), %edx
	cmpl	%ebx, %eax
	jg	.L40
.L34:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L38:
	.cfi_restore_state
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L40
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L42:
	.cfi_restore_state
	movl	%edx, (%rax,%rdi,4)
	jmp	.L36
	.cfi_endproc
.LFE40:
	.size	DFS, .-DFS
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-72(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	leaq	.LC0(%rip), %r12
	pushq	%rbx
	movq	%r12, %rdi
	subq	$88, %rsp
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	-68(%rbp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-72(%rbp), %rax
	testl	%eax, %eax
	jle	.L47
	leaq	reached(%rip), %r15
	leaq	0(,%rax,4), %rdx
	movl	$255, %esi
	movq	%r15, %rdi
	call	memset@PLT
.L47:
	movl	-68(%rbp), %esi
	leaq	-60(%rbp), %r15
	testl	%esi, %esi
	jle	.L46
	xorl	%r14d, %r14d
	leaq	-60(%rbp), %r15
	leaq	-64(%rbp), %r13
	leaq	.LC1(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L45:
	movq	%r15, %rdx
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	addl	$1, %r14d
	leal	-1(%rax), %edi
	movl	-60(%rbp), %eax
	movl	%edi, -64(%rbp)
	leal	-1(%rax), %esi
	movl	%esi, -60(%rbp)
	call	push_back
	movl	-64(%rbp), %esi
	movl	-60(%rbp), %edi
	call	push_back
	cmpl	%r14d, -68(%rbp)
	jg	.L45
.L46:
	movq	%r15, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	leal	-1(%rax), %edx
	cmpl	$99999, %edx
	ja	.L112
	leaq	15(,%rax,4), %rax
	movq	%rsp, %rcx
	movq	%rax, %rsi
	movq	%rax, %rdx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rcx
.L72:
	cmpq	%rcx, %rsp
	je	.L73
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L72
.L73:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L113
.L74:
	movq	%rax, %rsi
	movq	%rsp, -104(%rbp)
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rcx
.L75:
	cmpq	%rcx, %rsp
	je	.L76
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L75
.L112:
	xorl	%eax, %eax
	call	error@PLT
	movslq	-60(%rbp), %rdx
	movq	%rsp, %rsi
	movq	%rdx, %rax
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rdi
	movq	%rdx, %rcx
	andq	$-4096, %rdi
	andq	$-16, %rcx
	subq	%rdi, %rsi
.L50:
	cmpq	%rsi, %rsp
	je	.L51
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L50
.L113:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L74
.L76:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L114
.L77:
	movq	%rsp, -112(%rbp)
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rcx
.L78:
	cmpq	%rcx, %rsp
	je	.L79
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L78
.L51:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L115
.L52:
	movq	%rdx, %rdi
	movq	%rsp, -104(%rbp)
	movq	%rdx, %rcx
	movq	%rsp, %rsi
	andq	$-4096, %rdi
	andq	$-16, %rcx
	subq	%rdi, %rsi
.L53:
	cmpq	%rsi, %rsp
	je	.L54
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L53
.L115:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L52
.L114:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L77
.L79:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L80
	orq	$0, -8(%rsp,%rax)
.L80:
	movq	%rsp, -120(%rbp)
.L81:
	movq	-104(%rbp), %rbx
	movq	-112(%rbp), %r14
	xorl	%r13d, %r13d
	leaq	.LC2(%rip), %r12
	movq	-120(%rbp), %r15
	.p2align 4,,10
	.p2align 3
.L60:
	movq	%r15, %rcx
	movq	%r14, %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	addq	$4, %r14
	addq	$4, %r15
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	subl	$1, (%rbx)
	addq	$4, %rbx
	cmpl	%r13d, %eax
	jg	.L60
.L59:
	subl	$1, %eax
	leaq	reached(%rip), %r15
	movslq	%eax, %r14
	js	.L66
	.p2align 4,,10
	.p2align 3
.L65:
	movq	-112(%rbp), %rax
	movl	(%rax,%r14,4), %ecx
	movq	-104(%rbp), %rax
	movslq	(%rax,%r14,4), %rbx
	cmpl	(%r15,%rbx,4), %ecx
	jle	.L68
	movq	-120(%rbp), %rax
	movl	%ecx, (%r15,%rbx,4)
	movl	(%rax,%r14,4), %r10d
	leaq	color(%rip), %rax
	movl	(%rax,%rbx,4), %edx
	testl	%edx, %edx
	jne	.L67
	movl	%r10d, (%rax,%rbx,4)
.L67:
	salq	$4, %rbx
	leaq	edge(%rip), %rax
	addq	%rbx, %rax
	movl	8(%rax), %edx
	testl	%edx, %edx
	jle	.L68
	movq	(%rax), %rax
	leal	-1(%rcx), %r12d
	xorl	%r13d, %r13d
	movq	%rax, -96(%rbp)
.L71:
	movq	-96(%rbp), %rax
	movslq	(%rax,%r13,4), %rsi
	movq	%rsi, %rdi
	cmpl	%r12d, (%r15,%rsi,4)
	jge	.L69
	movl	%r10d, %edx
	movl	%r12d, %esi
	movl	%r10d, -84(%rbp)
	addq	$1, %r13
	call	DFS.part.0
	leaq	edge(%rip), %rax
	movl	-84(%rbp), %r10d
	movl	8(%rax,%rbx), %edx
	cmpl	%r13d, %edx
	jg	.L71
.L68:
	subq	$1, %r14
	testl	%r14d, %r14d
	jns	.L65
.L66:
	movl	-72(%rbp), %ecx
	xorl	%ebx, %ebx
	leaq	color(%rip), %r13
	leaq	.LC3(%rip), %r12
	testl	%ecx, %ecx
	jle	.L63
	.p2align 4,,10
	.p2align 3
.L62:
	movl	0(%r13,%rbx,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, -72(%rbp)
	jg	.L62
.L63:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L116
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L69:
	.cfi_restore_state
	addq	$1, %r13
	cmpl	%r13d, %edx
	jg	.L71
	jmp	.L68
.L54:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	je	.L55
	orq	$0, -8(%rsp,%rcx)
.L55:
	movq	%rsp, -112(%rbp)
	movq	%rdx, %rcx
	movq	%rsp, %rsi
	andq	$-4096, %rdx
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L56:
	cmpq	%rsi, %rsp
	je	.L57
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L56
.L57:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	je	.L58
	orq	$0, -8(%rsp,%rcx)
.L58:
	movq	%rsp, -120(%rbp)
	testl	%eax, %eax
	jg	.L81
	jmp	.L59
.L116:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	reached
	.bss
	.align 32
	.type	reached, @object
	.size	reached, 400200
reached:
	.zero	400200
	.globl	color
	.align 32
	.type	color, @object
	.size	color, 400200
color:
	.zero	400200
	.globl	edge
	.align 32
	.type	edge, @object
	.size	edge, 1600800
edge:
	.zero	1600800
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.type	DFS.part.0, @function
DFS.part.0:
.LFB43:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rax
	leaq	color(%rip), %r10
	leaq	reached(%rip), %r9
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movl	(%r10,%rax,4), %r12d
	movl	%esi, (%r9,%rax,4)
	movl	%esi, 64(%rsp)
	movl	%edx, 48(%rsp)
	testl	%r12d, %r12d
	jne	.L2
	movl	%edx, (%r10,%rax,4)
.L2:
	leaq	edge(%rip), %rcx
	salq	$4, %rax
	addq	%rcx, %rax
	movl	8(%rax), %ecx
	movq	%rax, 80(%rsp)
	testl	%ecx, %ecx
	jle	.L1
	movl	64(%rsp), %ebx
	movq	(%rax), %rax
	movq	$0, 32(%rsp)
	movq	%rax, 72(%rsp)
	leal	-2(%rbx), %eax
	leal	-1(%rbx), %edi
	movl	%eax, 52(%rsp)
	leal	-3(%rbx), %eax
	movl	%edi, 68(%rsp)
	movl	%eax, 88(%rsp)
.L19:
	movq	72(%rsp), %rax
	movq	32(%rsp), %rsi
	movl	68(%rsp), %edi
	movslq	(%rax,%rsi,4), %rax
	cmpl	%edi, (%r9,%rax,4)
	jge	.L4
	movl	(%r10,%rax,4), %ebp
	movl	%edi, (%r9,%rax,4)
	testl	%ebp, %ebp
	jne	.L5
	movl	48(%rsp), %esi
	movl	%esi, (%r10,%rax,4)
.L5:
	leaq	edge(%rip), %rdx
	salq	$4, %rax
	addq	%rdx, %rax
	movl	8(%rax), %edx
	movq	%rax, 56(%rsp)
	testl	%edx, %edx
	jle	.L4
	movq	(%rax), %rax
	movl	88(%rsp), %ecx
	movq	$0, 8(%rsp)
	movq	%rax, 40(%rsp)
	movl	64(%rsp), %eax
	leal	-4(%rax), %r8d
.L18:
	movq	8(%rsp), %rsi
	movq	40(%rsp), %rax
	movslq	(%rax,%rsi,4), %rax
	movl	52(%rsp), %esi
	cmpl	%esi, (%r9,%rax,4)
	jge	.L6
	movl	(%r10,%rax,4), %ebx
	movl	%esi, (%r9,%rax,4)
	testl	%ebx, %ebx
	jne	.L7
	movl	48(%rsp), %edi
	movl	%edi, (%r10,%rax,4)
.L7:
	salq	$4, %rax
	leaq	edge(%rip), %rsi
	addq	%rax, %rsi
	movl	8(%rsi), %eax
	movq	%rsi, 24(%rsp)
	testl	%eax, %eax
	jle	.L6
	movq	(%rsi), %rsi
	movl	64(%rsp), %edx
	xorl	%r15d, %r15d
	movq	%rsi, 16(%rsp)
	leal	-5(%rdx), %esi
.L17:
	movq	16(%rsp), %rdx
	movslq	(%rdx,%r15,4), %r13
	cmpl	%ecx, (%r9,%r13,4)
	jge	.L8
	movl	(%r10,%r13,4), %r11d
	movl	%ecx, (%r9,%r13,4)
	testl	%r11d, %r11d
	jne	.L9
	movl	48(%rsp), %edx
	movl	%edx, (%r10,%r13,4)
.L9:
	salq	$4, %r13
	leaq	edge(%rip), %rbx
	addq	%rbx, %r13
	movl	8(%r13), %edx
	testl	%edx, %edx
	jle	.L8
	movq	0(%r13), %rax
	xorl	%r12d, %r12d
.L16:
	movslq	(%rax,%r12,4), %rbp
	cmpl	%r8d, (%r9,%rbp,4)
	jge	.L10
	movl	(%r10,%rbp,4), %edi
	movl	%r8d, (%r9,%rbp,4)
	testl	%edi, %edi
	jne	.L11
	movl	48(%rsp), %edi
	movl	%edi, (%r10,%rbp,4)
.L11:
	salq	$4, %rbp
	leaq	edge(%rip), %rdi
	addq	%rbp, %rdi
	movl	8(%rdi), %r11d
	testl	%r11d, %r11d
	jle	.L10
	movq	(%rdi), %r14
	xorl	%ebx, %ebx
.L15:
	movslq	(%r14,%rbx,4), %rdx
	movq	%rdx, %rdi
	cmpl	%esi, (%r9,%rdx,4)
	jge	.L12
	movl	48(%rsp), %edx
	movl	%ecx, 108(%rsp)
	addq	$1, %rbx
	movl	%r8d, 104(%rsp)
	movq	%rax, 96(%rsp)
	movl	%esi, 92(%rsp)
	call	DFS.part.0
	leaq	edge(%rip), %rax
	movl	92(%rsp), %esi
	movl	104(%rsp), %r8d
	movl	8(%rax,%rbp), %r11d
	movl	108(%rsp), %ecx
	leaq	reached(%rip), %r9
	leaq	color(%rip), %r10
	movq	96(%rsp), %rax
	cmpl	%ebx, %r11d
	jg	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movl	8(%r13), %edx
.L10:
	addq	$1, %r12
	cmpl	%r12d, %edx
	jg	.L16
	movq	24(%rsp), %rax
	movl	8(%rax), %eax
.L8:
	addq	$1, %r15
	cmpl	%r15d, %eax
	jg	.L17
	movq	56(%rsp), %rax
	movl	8(%rax), %edx
.L6:
	addq	$1, 8(%rsp)
	movq	8(%rsp), %rax
	cmpl	%eax, %edx
	jg	.L18
	movq	80(%rsp), %rax
	movl	8(%rax), %ecx
.L4:
	addq	$1, 32(%rsp)
	movq	32(%rsp), %rax
	cmpl	%eax, %ecx
	jg	.L19
.L1:
	addq	$120, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L12:
	.cfi_restore_state
	addq	$1, %rbx
	cmpl	%ebx, %r11d
	jg	.L15
	jmp	.L14
	.cfi_endproc
.LFE43:
	.size	DFS.part.0, .-DFS.part.0
	.p2align 4
	.globl	push_back
	.type	push_back, @function
push_back:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movslq	%edi, %rdi
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	salq	$4, %rdi
	leaq	edge(%rip), %rbx
	addq	%rdi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movl	8(%rbx), %edx
	testl	%edx, %edx
	je	.L33
	movl	12(%rbx), %eax
	addl	$1, %edx
	movl	%edx, 8(%rbx)
	cmpl	%eax, %edx
	jg	.L30
	movq	(%rbx), %rax
.L31:
	movslq	%edx, %rdx
	movl	%ebp, -4(%rax,%rdx,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L30:
	.cfi_restore_state
	addl	%eax, %eax
	movq	(%rbx), %rdi
	movl	%eax, 12(%rbx)
	cltq
	leaq	0(,%rax,4), %rsi
	call	realloc@PLT
	movl	8(%rbx), %edx
	movq	%rax, (%rbx)
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L33:
	addl	$1, 12(%rbx)
	movl	$4, %edi
	movl	$1, 8(%rbx)
	call	malloc@PLT
	movq	%rax, (%rbx)
	movl	%ebp, (%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE39:
	.size	push_back, .-push_back
	.p2align 4
	.globl	DFS
	.type	DFS, @function
DFS:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rdi
	leaq	reached(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	cmpl	%esi, (%r15,%rdi,4)
	jge	.L34
	leaq	color(%rip), %rax
	movl	%esi, (%r15,%rdi,4)
	movl	(%rax,%rdi,4), %ecx
	testl	%ecx, %ecx
	je	.L42
.L36:
	salq	$4, %rdi
	leaq	edge(%rip), %r13
	leaq	0(%r13,%rdi), %rcx
	movq	%rdi, %r12
	movl	8(%rcx), %eax
	testl	%eax, %eax
	jle	.L34
	movq	(%rcx), %r14
	leal	-1(%rsi), %ebp
	xorl	%ebx, %ebx
.L40:
	movslq	(%r14,%rbx,4), %rcx
	movq	%rcx, %rdi
	cmpl	%ebp, (%r15,%rcx,4)
	jge	.L38
	movl	%ebp, %esi
	movl	%edx, 12(%rsp)
	addq	$1, %rbx
	call	DFS.part.0
	movl	8(%r13,%r12), %eax
	movl	12(%rsp), %edx
	cmpl	%ebx, %eax
	jg	.L40
.L34:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L38:
	.cfi_restore_state
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L40
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L42:
	.cfi_restore_state
	movl	%edx, (%rax,%rdi,4)
	jmp	.L36
	.cfi_endproc
.LFE40:
	.size	DFS, .-DFS
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-72(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	leaq	.LC0(%rip), %r12
	pushq	%rbx
	movq	%r12, %rdi
	subq	$88, %rsp
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	-68(%rbp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-72(%rbp), %rax
	testl	%eax, %eax
	jle	.L47
	leaq	reached(%rip), %r15
	leaq	0(,%rax,4), %rdx
	movl	$255, %esi
	movq	%r15, %rdi
	call	memset@PLT
.L47:
	movl	-68(%rbp), %esi
	leaq	-60(%rbp), %r15
	testl	%esi, %esi
	jle	.L46
	xorl	%r14d, %r14d
	leaq	-60(%rbp), %r15
	leaq	-64(%rbp), %r13
	leaq	.LC1(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L45:
	movq	%r15, %rdx
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	addl	$1, %r14d
	leal	-1(%rax), %edi
	movl	-60(%rbp), %eax
	movl	%edi, -64(%rbp)
	leal	-1(%rax), %esi
	movl	%esi, -60(%rbp)
	call	push_back
	movl	-64(%rbp), %esi
	movl	-60(%rbp), %edi
	call	push_back
	cmpl	%r14d, -68(%rbp)
	jg	.L45
.L46:
	movq	%r15, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	leal	-1(%rax), %edx
	cmpl	$99999, %edx
	ja	.L112
	leaq	15(,%rax,4), %rax
	movq	%rsp, %rcx
	movq	%rax, %rsi
	movq	%rax, %rdx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rcx
.L72:
	cmpq	%rcx, %rsp
	je	.L73
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L72
.L73:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L113
.L74:
	movq	%rax, %rsi
	movq	%rsp, -104(%rbp)
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rcx
.L75:
	cmpq	%rcx, %rsp
	je	.L76
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L75
.L112:
	xorl	%eax, %eax
	call	error@PLT
	movslq	-60(%rbp), %rdx
	movq	%rsp, %rsi
	movq	%rdx, %rax
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rdi
	movq	%rdx, %rcx
	andq	$-4096, %rdi
	andq	$-16, %rcx
	subq	%rdi, %rsi
.L50:
	cmpq	%rsi, %rsp
	je	.L51
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L50
.L113:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L74
.L76:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L114
.L77:
	movq	%rsp, -112(%rbp)
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rcx
.L78:
	cmpq	%rcx, %rsp
	je	.L79
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L78
.L51:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L115
.L52:
	movq	%rdx, %rdi
	movq	%rsp, -104(%rbp)
	movq	%rdx, %rcx
	movq	%rsp, %rsi
	andq	$-4096, %rdi
	andq	$-16, %rcx
	subq	%rdi, %rsi
.L53:
	cmpq	%rsi, %rsp
	je	.L54
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L53
.L115:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L52
.L114:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L77
.L79:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L80
	orq	$0, -8(%rsp,%rax)
.L80:
	movq	%rsp, -120(%rbp)
.L81:
	movq	-104(%rbp), %rbx
	movq	-112(%rbp), %r14
	xorl	%r13d, %r13d
	leaq	.LC2(%rip), %r12
	movq	-120(%rbp), %r15
	.p2align 4,,10
	.p2align 3
.L60:
	movq	%r15, %rcx
	movq	%r14, %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	addq	$4, %r14
	addq	$4, %r15
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	subl	$1, (%rbx)
	addq	$4, %rbx
	cmpl	%r13d, %eax
	jg	.L60
.L59:
	subl	$1, %eax
	leaq	reached(%rip), %r15
	movslq	%eax, %r14
	js	.L66
	.p2align 4,,10
	.p2align 3
.L65:
	movq	-112(%rbp), %rax
	movl	(%rax,%r14,4), %ecx
	movq	-104(%rbp), %rax
	movslq	(%rax,%r14,4), %rbx
	cmpl	(%r15,%rbx,4), %ecx
	jle	.L68
	movq	-120(%rbp), %rax
	movl	%ecx, (%r15,%rbx,4)
	movl	(%rax,%r14,4), %r10d
	leaq	color(%rip), %rax
	movl	(%rax,%rbx,4), %edx
	testl	%edx, %edx
	jne	.L67
	movl	%r10d, (%rax,%rbx,4)
.L67:
	salq	$4, %rbx
	leaq	edge(%rip), %rax
	addq	%rbx, %rax
	movl	8(%rax), %edx
	testl	%edx, %edx
	jle	.L68
	movq	(%rax), %rax
	leal	-1(%rcx), %r12d
	xorl	%r13d, %r13d
	movq	%rax, -96(%rbp)
.L71:
	movq	-96(%rbp), %rax
	movslq	(%rax,%r13,4), %rsi
	movq	%rsi, %rdi
	cmpl	%r12d, (%r15,%rsi,4)
	jge	.L69
	movl	%r10d, %edx
	movl	%r12d, %esi
	movl	%r10d, -84(%rbp)
	addq	$1, %r13
	call	DFS.part.0
	leaq	edge(%rip), %rax
	movl	-84(%rbp), %r10d
	movl	8(%rax,%rbx), %edx
	cmpl	%r13d, %edx
	jg	.L71
.L68:
	subq	$1, %r14
	testl	%r14d, %r14d
	jns	.L65
.L66:
	movl	-72(%rbp), %ecx
	xorl	%ebx, %ebx
	leaq	color(%rip), %r13
	leaq	.LC3(%rip), %r12
	testl	%ecx, %ecx
	jle	.L63
	.p2align 4,,10
	.p2align 3
.L62:
	movl	0(%r13,%rbx,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, -72(%rbp)
	jg	.L62
.L63:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L116
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L69:
	.cfi_restore_state
	addq	$1, %r13
	cmpl	%r13d, %edx
	jg	.L71
	jmp	.L68
.L54:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	je	.L55
	orq	$0, -8(%rsp,%rcx)
.L55:
	movq	%rsp, -112(%rbp)
	movq	%rdx, %rcx
	movq	%rsp, %rsi
	andq	$-4096, %rdx
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L56:
	cmpq	%rsi, %rsp
	je	.L57
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L56
.L57:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	je	.L58
	orq	$0, -8(%rsp,%rcx)
.L58:
	movq	%rsp, -120(%rbp)
	testl	%eax, %eax
	jg	.L81
	jmp	.L59
.L116:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	reached
	.bss
	.align 32
	.type	reached, @object
	.size	reached, 400200
reached:
	.zero	400200
	.globl	color
	.align 32
	.type	color, @object
	.size	color, 400200
color:
	.zero	400200
	.globl	edge
	.align 32
	.type	edge, @object
	.size	edge, 1600800
edge:
	.zero	1600800
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include<stdio.h>
#include<stdlib.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++) //単純なループの簡略化
typedef struct{int *A,size,maxsize;}vector; //疑似的な可変長配列

vector edge[100050]; //辺の情報を保持
int color[100050]; //頂点の色の情報を保持
int reached[100050]; //最大残り距離いくつでその頂点に到達したことがあるかを保持、ただし-1の時未到達を意味する

void push_back(int v,int push){ //vectorのpush_back機能
    if(edge[v].size==0){
        edge[v].size++;
        edge[v].maxsize++;
        edge[v].A=(int*)malloc(sizeof(int));
        edge[v].A[0]=push;
    }
    else{
        edge[v].size++;
        if(edge[v].size>edge[v].maxsize){ //可変長配列の長さが足りなくなった場合、元の2倍の大きさの領域を再確保
            edge[v].maxsize*=2;
            edge[v].A=(int*)realloc(edge[v].A,sizeof(int)*edge[v].maxsize);
        }
        edge[v].A[edge[v].size-1]=push;
    }
}

void DFS(int V,int dis,int paint){ //入力されたグラフ上での枝狩り深さ優先探索
    if(reached[V]>=dis) return; //到達時の残り距離が以前到達したときより短いなら打ち切る
    reached[V]=dis; //到達時の残り距離を更新
    if(color[V]==0) color[V]=paint; //まだ塗られていない場合、色を塗る
    rep(i,edge[V].size) DFS(edge[V].A[i],dis-1,paint); //隣接している全ての頂点へ移動する
}

int main(void){
    int N,M;
    scanf("%d",&N); //頂点数の入力
    scanf("%d",&M); //辺の数の入力
    rep(i,N) reached[i]=-1; //全ての頂点を未到達を意味する-1で初期化
    rep(i,M){ //辺の情報の入力
        int a,b;
        scanf("%d%d",&a,&b);
        a--,b--; // 0-indexedに直す
        push_back(a,b); //双方向に辺を張る
        push_back(b,a);
    }
    int Q;
    scanf("%d",&Q); //操作の回数の入力
    if(Q<1 || Q>100000) error();
    int V[Q],D[Q],C[Q];
    rep(i,Q){ //操作の入力
        scanf("%d%d%d",&V[i],&D[i],&C[i]);
        V[i]--; // 0-indexedに直す
    }
    for(int i=Q-1;i>=0;i--) DFS(V[i],D[i],C[i]); //枝狩り深さ優先探索を入力の逆順に実行
    rep(i,N) printf("%d\n",color[i]); //結果の出力
    return 0;
}
14 10
1 4
5 7
7 11
4 10
14 7
14 3
6 14
8 11
5 13
8 3
8
8 6 2
14 7 85
6 9 3
6 7 5
10 3 1
12 9 4
9 6 6
8 2 3
 14 10
1 4
5 7
7 11
2 10
14 7
14 3
6 14
8 11
5 13
8 3
8
8 6 2
14 7 85
6 9 6
6 7 5
10 3 1
12 9 4
9 6 6
8 2 3
 14 10
1 4
5 7
7 11
2 10
14 7
14 3
6 14
8 11
5 13
8 3
8
8 7 2
14 7 85
6 9 6
6 7 5
10 3 1
12 9 4
9 6 6
8 4 3
 14 10
1 4
5 7
7 11
2 10
14 7
14 3
6 14
8 11
5 13
8 3
3
8 7 4
14 7 85
6 9 6
6 7 5
10 3 1
12 9 4
9 2 6
8 4 3
 14 10
1 4
9 7
7 11
2 10
14 7
14 3
6 14
8 14
5 13
8 3
3
8 7 4
14 7 85
6 9 6
6 7 5
10 3 1
12 9 4
9 2 6
8 4 3
 14 10
1 4
5 5
7 11
4 10
14 7
14 3
6 14
8 11
5 13
8 3
8
8 6 2
9 7 85
6 9 3
6 7 5
10 3 1
12 9 4
9 6 6
8 2 3
 7 7
1 2
1 3
1 4
4 5
5 6
5 7
2 3
2
6 0 1
1 2 2
 14 10
1 4
5 7
7 11
4 10
14 7
14 3
6 14
8 11
5 13
9 3
8
8 6 2
14 7 85
6 9 3
6 7 5
10 3 1
12 9 4
9 6 6
8 2 3
 14 10
1 4
5 7
7 11
4 10
14 7
14 3
6 14
8 11
5 13
8 3
8
8 6 2
14 7 85
6 9 6
6 7 5
10 3 1
12 9 4
9 6 6
1 2 3
 14 10
1 4
5 7
7 11
2 10
14 7
14 3
6 14
8 11
5 13
8 3
5
8 6 2
14 7 85
6 9 6
6 7 5
10 3 1
12 9 4
9 6 6
8 2 3

1
0
3
1
5
5
3
3
6
1
3
4
5
3
 0
1
3
0
5
5
3
3
6
1
3
4
5
3
 0
1
3
0
3
3
3
3
6
1
3
4
3
3
 0
0
6
0
6
6
6
6
0
0
6
0
6
6
 0
0
6
0
0
6
6
6
6
0
6
0
0
6
 1
0
3
1
0
5
3
3
6
1
3
4
0
3
 2
2
2
2
2
1
0
 1
0
6
1
6
6
3
3
6
1
3
4
6
6
 3
0
5
3
5
5
5
5
6
3
5
4
5
5
 0
1
5
0
5
5
5
5
0
1
5
0
5
5

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#include<stdlib.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++) //単純なループの簡略化
typedef struct{int *A,size,maxsize;}vector; //疑似的な可変長配列

vector edge[100050]; //辺の情報を保持
int color[100050]; //頂点の色の情報を保持
int reached[100050]; //最大残り距離いくつでその頂点に到達したことがあるかを保持、ただし-1の時未到達を意味する

void push_back(int v,int push){ //vectorのpush_back機能
    if(edge[v].size==0){
        edge[v].size++;
        edge[v].maxsize++;
        edge[v].A=(int*)malloc(sizeof(int));
        edge[v].A[0]=push;
    }
    else{
        edge[v].size++;
        if(edge[v].size>edge[v].maxsize){ //可変長配列の長さが足りなくなった場合、元の2倍の大きさの領域を再確保
            edge[v].maxsize*=2;
            edge[v].A=(int*)realloc(edge[v].A,sizeof(int)*edge[v].maxsize);
        }
        edge[v].A[edge[v].size-1]=push;
    }
}

void DFS(int V,int dis,int paint){ //入力されたグラフ上での枝狩り深さ優先探索
    if(reached[V]>=dis) return; //到達時の残り距離が以前到達したときより短いなら打ち切る
    reached[V]=dis; //到達時の残り距離を更新
    if(color[V]==0) color[V]=paint; //まだ塗られていない場合、色を塗る
    rep(i,edge[V].size) DFS(edge[V].A[i],dis-1,paint); //隣接している全ての頂点へ移動する
}

int main(void){
    int N,M;
    scanf("%d",&N); //頂点数の入力
    scanf("%d",&M); //辺の数の入力
    rep(i,N) reached[i]=-1; //全ての頂点を未到達を意味する-1で初期化
    rep(i,M){ //辺の情報の入力
        int a,b;
        scanf("%d%d",&a,&b);
        a--,b--; // 0-indexedに直す
        push_back(a,b); //双方向に辺を張る
        push_back(b,a);
    }
    int Q;
    scanf("%d",&Q); //操作の回数の入力
    if(Q<1 || Q>100000) error();
    int V[Q],D[Q],C[Q];
    rep(i,Q){ //操作の入力
        scanf("%d%d%d",&V[i],&D[i],&C[i]);
        V[i]--; // 0-indexedに直す
    }
    for(int i=Q-1;i>=0;i--) DFS(V[i],D[i],C[i]); //枝狩り深さ優先探索を入力の逆順に実行
    rep(i,N) printf("%d\n",color[i]); //結果の出力
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	edge
	.bss
	.align 32
	.type	edge, @object
	.size	edge, 1600800
edge:
	.zero	1600800
	.globl	color
	.align 32
	.type	color, @object
	.size	color, 400200
color:
	.zero	400200
	.globl	reached
	.align 32
	.type	reached, @object
	.size	reached, 400200
reached:
	.zero	400200
	.text
	.globl	push_back
	.type	push_back, @function
push_back:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	$4, %edi
	call	malloc@PLT
	movq	%rax, %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	edge(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	edge(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-8(%rbp), %edx
	movl	%edx, (%rax)
	jmp	.L5
.L2:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	12+edge(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rax,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	edge(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	realloc@PLT
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	edge(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L4:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	edge(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
.L5:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	push_back, .-push_back
	.globl	DFS
	.type	DFS, @function
DFS:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	reached(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L12
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	reached(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	color(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L9
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	color(%rip), %rdx
	movl	-28(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L9:
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-24(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	edge(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-28(%rbp), %edx
	movl	%ecx, %esi
	movl	%eax, %edi
	call	DFS
	addl	$1, -4(%rbp)
.L10:
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	jmp	.L6
.L12:
	nop
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	DFS, .-DFS
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$168, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-140(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -124(%rbp)
	jmp	.L14
.L15:
	movl	-124(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	reached(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -124(%rbp)
.L14:
	movl	-140(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L15
	movl	$0, -120(%rbp)
	jmp	.L16
.L17:
	leaq	-128(%rbp), %rax
	leaq	-132(%rbp), %rcx
	movq	%rax, %rdx
	movq	%rcx, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-132(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -132(%rbp)
	movl	-128(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -128(%rbp)
	movl	-128(%rbp), %eax
	movl	-132(%rbp), %edx
	movl	%eax, %esi
	movl	%edx, %edi
	call	push_back
	movl	-132(%rbp), %eax
	movl	-128(%rbp), %edx
	movl	%eax, %esi
	movl	%edx, %edi
	call	push_back
	addl	$1, -120(%rbp)
.L16:
	movl	-136(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L17
	leaq	-128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-128(%rbp), %eax
	testl	%eax, %eax
	jle	.L18
	movl	-128(%rbp), %eax
	cmpl	$100000, %eax
	jle	.L19
.L18:
	movl	$0, %eax
	call	error@PLT
.L19:
	movl	-128(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%edx, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movslq	%edx, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L20:
	cmpq	%rdx, %rsp
	je	.L21
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L20
.L21:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L22
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L22:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -208(%rbp)
	movq	$0, -200(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L23:
	cmpq	%rdx, %rsp
	je	.L24
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L23
.L24:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L25
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L25:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L26:
	cmpq	%rdx, %rsp
	je	.L27
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L26
.L27:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L28
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L28:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -116(%rbp)
	jmp	.L29
.L30:
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rax, %rdx
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-96(%rbp), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-96(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %ecx
	movq	-96(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -116(%rbp)
.L29:
	movl	-128(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L30
	movl	-128(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -112(%rbp)
	jmp	.L31
.L32:
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	-80(%rbp), %rax
	movl	-112(%rbp), %ecx
	movslq	%ecx, %rcx
	movl	(%rax,%rcx,4), %ecx
	movq	-96(%rbp), %rax
	movl	-112(%rbp), %esi
	movslq	%esi, %rsi
	movl	(%rax,%rsi,4), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	DFS
	subl	$1, -112(%rbp)
.L31:
	cmpl	$0, -112(%rbp)
	jns	.L32
	movl	$0, -108(%rbp)
	jmp	.L33
.L34:
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	color(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -108(%rbp)
.L33:
	movl	-140(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L34
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L36
	call	__stack_chk_fail@PLT
.L36:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	edge
	.bss
	.align 32
	.type	edge, @object
	.size	edge, 1600800
edge:
	.zero	1600800
	.globl	color
	.align 32
	.type	color, @object
	.size	color, 400200
color:
	.zero	400200
	.globl	reached
	.align 32
	.type	reached, @object
	.size	reached, 400200
reached:
	.zero	400200
	.text
	.globl	push_back
	.type	push_back, @function
push_back:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	$4, %edi
	call	malloc@PLT
	movq	%rax, %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	edge(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	edge(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-8(%rbp), %edx
	movl	%edx, (%rax)
	jmp	.L5
.L2:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	12+edge(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rax,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	edge(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	realloc@PLT
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	edge(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L4:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	edge(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
.L5:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	push_back, .-push_back
	.globl	DFS
	.type	DFS, @function
DFS:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	reached(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L12
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	reached(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	color(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L9
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	color(%rip), %rdx
	movl	-28(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L9:
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-24(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	edge(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-28(%rbp), %edx
	movl	%ecx, %esi
	movl	%eax, %edi
	call	DFS
	addl	$1, -4(%rbp)
.L10:
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+edge(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	jmp	.L6
.L12:
	nop
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	DFS, .-DFS
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$168, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-140(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -124(%rbp)
	jmp	.L14
.L15:
	movl	-124(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	reached(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -124(%rbp)
.L14:
	movl	-140(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L15
	movl	$0, -120(%rbp)
	jmp	.L16
.L17:
	leaq	-128(%rbp), %rax
	leaq	-132(%rbp), %rcx
	movq	%rax, %rdx
	movq	%rcx, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-132(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -132(%rbp)
	movl	-128(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -128(%rbp)
	movl	-128(%rbp), %eax
	movl	-132(%rbp), %edx
	movl	%eax, %esi
	movl	%edx, %edi
	call	push_back
	movl	-132(%rbp), %eax
	movl	-128(%rbp), %edx
	movl	%eax, %esi
	movl	%edx, %edi
	call	push_back
	addl	$1, -120(%rbp)
.L16:
	movl	-136(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L17
	leaq	-128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-128(%rbp), %eax
	testl	%eax, %eax
	jle	.L18
	movl	-128(%rbp), %eax
	cmpl	$100000, %eax
	jle	.L19
.L18:
	movl	$0, %eax
	call	error@PLT
.L19:
	movl	-128(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%edx, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movslq	%edx, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L20:
	cmpq	%rdx, %rsp
	je	.L21
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L20
.L21:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L22
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L22:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -208(%rbp)
	movq	$0, -200(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L23:
	cmpq	%rdx, %rsp
	je	.L24
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L23
.L24:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L25
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L25:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L26:
	cmpq	%rdx, %rsp
	je	.L27
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L26
.L27:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L28
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L28:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -116(%rbp)
	jmp	.L29
.L30:
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rax, %rdx
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-96(%rbp), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-96(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %ecx
	movq	-96(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -116(%rbp)
.L29:
	movl	-128(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L30
	movl	-128(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -112(%rbp)
	jmp	.L31
.L32:
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	-80(%rbp), %rax
	movl	-112(%rbp), %ecx
	movslq	%ecx, %rcx
	movl	(%rax,%rcx,4), %ecx
	movq	-96(%rbp), %rax
	movl	-112(%rbp), %esi
	movslq	%esi, %rsi
	movl	(%rax,%rsi,4), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	DFS
	subl	$1, -112(%rbp)
.L31:
	cmpl	$0, -112(%rbp)
	jns	.L32
	movl	$0, -108(%rbp)
	jmp	.L33
.L34:
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	color(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -108(%rbp)
.L33:
	movl	-140(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L34
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L36
	call	__stack_chk_fail@PLT
.L36:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
