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>

typedef struct directedGraph{
  int *vertex;
  int *next;
  int *start;
  int v,e;
  int pointer;
} graph;

graph* newGraph(const int v,const int e){
  graph *g=(graph *)malloc(sizeof(graph));
  g->vertex=(int *)calloc(e,sizeof(int));
  g->next=(int *)calloc(e,sizeof(int));
  g->start=(int *)calloc(v,sizeof(int));
  for(int i=0;i<v;i++) g->start[i]=-1;
  g->v=v;
  g->e=e;
  g->pointer=0;
  return g;
}

void freeGraph(graph *g){
  free(g->vertex);
  free(g->next);
  free(g->start);
  free(g);
  return;
}

void addEdge(graph *g,const int from,const int to){
  const int p=g->pointer;
  g->vertex[p]=to;
  g->next[p]=g->start[from];
  g->start[from]=p;
  g->pointer++;
  return;
}

typedef struct node{
  int t;
  int c;
} node;

#define POS(rad,v) ((rad)*n+(v))

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  graph *g=newGraph(n,2*m);
  while(m--){
    int a,b;
    scanf("%d%d",&a,&b);
    a--;b--;
    addEdge(g,a,b);
    addEdge(g,b,a);
  }
  const int f=10;
  node *dp=(node *)calloc(n*(f+1),sizeof(node));
  int i;
  for(i=0;i<(f+1)*n;i++) dp[i]=(node){0,0};
  int q;
  scanf("%d",&q);
  for(i=1;i<=q;i++){
    int v,d,c;
    scanf("%d%d%d",&v,&d,&c);
    v--;
    dp[POS(d,v)]=(node){i,c};
  }
  for(i=f;i>0;i--){
    for(int v=0;v<n;v++){
      if(dp[POS(i-1,v)].t<dp[POS(i,v)].t) dp[POS(i-1,v)]=dp[POS(i,v)];
      for(int p=g->start[v];p!=-1;p=g->next[p]){
	int u=g->vertex[p];
	if(dp[POS(i-1,u)].t<dp[POS(i,v)].t){
	  dp[POS(i-1,u)]=dp[POS(i,v)];
	}
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d\n",dp[POS(0,i)].c);
  }
}

int main(void){
  run();
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	newGraph
	.type	newGraph, @function
newGraph:
.LFB6:
	.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	$40, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movl	-24(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, (%rax)
	movl	-24(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
	movl	-20(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 16(%rax)
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	movq	-8(%rbp), %rax
	movq	16(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -12(%rbp)
.L2:
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L3
	movq	-8(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, 24(%rax)
	movq	-8(%rbp), %rax
	movl	-24(%rbp), %edx
	movl	%edx, 28(%rax)
	movq	-8(%rbp), %rax
	movl	$0, 32(%rax)
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	newGraph, .-newGraph
	.globl	freeGraph
	.type	freeGraph, @function
freeGraph:
.LFB7:
	.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
	movq	%rdi, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	freeGraph, .-freeGraph
	.globl	addEdge
	.type	addEdge, @function
addEdge:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movq	-24(%rbp), %rax
	movl	32(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	movq	16(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	movq	-24(%rbp), %rax
	movq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	movq	16(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	movl	32(%rax), %eax
	leal	1(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 32(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	addEdge, .-addEdge
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rdx
	leaq	-68(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-68(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	newGraph
	movq	%rax, -24(%rbp)
	jmp	.L10
.L11:
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -52(%rbp)
	movl	-48(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -48(%rbp)
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	addEdge
	movl	-52(%rbp), %edx
	movl	-48(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	addEdge
.L10:
	movl	-64(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -64(%rbp)
	testl	%eax, %eax
	jne	.L11
	movl	$10, -32(%rbp)
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	-68(%rbp), %eax
	imull	%edx, %eax
	cltq
	movl	$8, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L12
.L13:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movl	$0, 4(%rax)
	addl	$1, -44(%rbp)
.L12:
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	-68(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -44(%rbp)
	jl	.L13
	leaq	-60(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -44(%rbp)
	jmp	.L14
.L15:
	leaq	-48(%rbp), %rcx
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -56(%rbp)
	movl	-52(%rbp), %edx
	movl	-68(%rbp), %eax
	imull	%eax, %edx
	movl	-56(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %ecx
	movl	%ecx, (%rax)
	movl	%edx, 4(%rax)
	addl	$1, -44(%rbp)
.L14:
	movl	-60(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L15
	movl	-32(%rbp), %eax
	movl	%eax, -44(%rbp)
	jmp	.L16
.L23:
	movl	$0, -40(%rbp)
	jmp	.L17
.L22:
	movl	-44(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-68(%rbp), %eax
	imull	%eax, %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-68(%rbp), %eax
	imull	-44(%rbp), %eax
	movl	%eax, %ecx
	movl	-40(%rbp), %eax
	addl	%ecx, %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L18
	movl	-68(%rbp), %eax
	imull	-44(%rbp), %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	-44(%rbp), %edx
	leal	-1(%rdx), %ecx
	movl	-68(%rbp), %edx
	imull	%edx, %ecx
	movl	-40(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
.L18:
	movq	-24(%rbp), %rax
	movq	16(%rax), %rdx
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -36(%rbp)
	jmp	.L19
.L21:
	movq	-24(%rbp), %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -28(%rbp)
	movl	-44(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-68(%rbp), %eax
	imull	%eax, %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-68(%rbp), %eax
	imull	-44(%rbp), %eax
	movl	%eax, %ecx
	movl	-40(%rbp), %eax
	addl	%ecx, %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L20
	movl	-68(%rbp), %eax
	imull	-44(%rbp), %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	-44(%rbp), %edx
	leal	-1(%rdx), %ecx
	movl	-68(%rbp), %edx
	imull	%edx, %ecx
	movl	-28(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
.L20:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -36(%rbp)
.L19:
	cmpl	$-1, -36(%rbp)
	jne	.L21
	addl	$1, -40(%rbp)
.L17:
	movl	-68(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L22
	subl	$1, -44(%rbp)
.L16:
	cmpl	$0, -44(%rbp)
	jg	.L23
	movl	$0, -44(%rbp)
	jmp	.L24
.L25:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -44(%rbp)
.L24:
	movl	-68(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L25
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	run, .-run
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	call	run
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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
	.globl	newGraph
	.type	newGraph, @function
newGraph:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movslq	%esi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movslq	%edi, %rbx
	movd	%ebp, %xmm1
	movl	$40, %edi
	movd	%ebx, %xmm0
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, %r14
	call	malloc@PLT
	movl	$4, %esi
	movq	%rbp, %rdi
	movq	%rax, %r12
	call	calloc@PLT
	movl	$4, %esi
	movq	%rbp, %rdi
	movq	%rax, (%r12)
	call	calloc@PLT
	movl	$4, %esi
	movq	%rbx, %rdi
	movq	%rax, 8(%r12)
	call	calloc@PLT
	movq	%rax, 16(%r12)
	testl	%ebx, %ebx
	jle	.L2
	movq	%rax, %rdi
	leaq	0(,%rbx,4), %rdx
	movl	$255, %esi
	call	memset@PLT
.L2:
	popq	%rbx
	.cfi_def_cfa_offset 40
	movq	%r12, %rax
	popq	%rbp
	.cfi_def_cfa_offset 32
	movq	%r14, 24(%r12)
	movl	$0, 32(%r12)
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE39:
	.size	newGraph, .-newGraph
	.p2align 4
	.globl	freeGraph
	.type	freeGraph, @function
freeGraph:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rbp
	movq	(%rdi), %rdi
	call	free@PLT
	movq	8(%rbp), %rdi
	call	free@PLT
	movq	16(%rbp), %rdi
	call	free@PLT
	movq	%rbp, %rdi
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE40:
	.size	freeGraph, .-freeGraph
	.p2align 4
	.globl	addEdge
	.type	addEdge, @function
addEdge:
.LFB41:
	.cfi_startproc
	endbr64
	movslq	32(%rdi), %rcx
	movq	(%rdi), %rax
	movslq	%esi, %rsi
	movl	%edx, (%rax,%rcx,4)
	movq	16(%rdi), %rax
	leaq	(%rax,%rsi,4), %rax
	movq	8(%rdi), %rsi
	movl	(%rax), %r8d
	movl	%r8d, (%rsi,%rcx,4)
	movl	%ecx, (%rax)
	addl	$1, 32(%rdi)
	ret
	.cfi_endproc
.LFE41:
	.size	addEdge, .-addEdge
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB42:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	52(%rsp), %rdx
	leaq	48(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %r8d
	movl	48(%rsp), %ecx
	movl	$40, %edi
	leal	(%r8,%r8), %r12d
	movd	%ecx, %xmm3
	movl	%r8d, 32(%rsp)
	movd	%r12d, %xmm4
	movslq	%r12d, %r12
	movl	%ecx, 16(%rsp)
	punpckldq	%xmm4, %xmm3
	movq	%xmm3, 8(%rsp)
	call	malloc@PLT
	movl	$4, %esi
	movq	%r12, %rdi
	movq	%rax, %r14
	call	calloc@PLT
	movl	$4, %esi
	movq	%r12, %rdi
	movq	%rax, (%r14)
	movq	%rax, %rbp
	call	calloc@PLT
	movslq	16(%rsp), %r13
	movl	$4, %esi
	movq	%rax, 8(%r14)
	movq	%rax, %r15
	movq	%r13, %rdi
	movl	%r13d, 24(%rsp)
	call	calloc@PLT
	movl	24(%rsp), %ecx
	movl	32(%rsp), %r8d
	movq	%rax, 16(%rsp)
	testl	%ecx, %ecx
	movq	%rax, 16(%r14)
	jle	.L12
	movq	%rax, %rdi
	leaq	0(,%r13,4), %rdx
	movl	$255, %esi
	movl	%ecx, 32(%rsp)
	movl	%r8d, 24(%rsp)
	call	memset@PLT
	movl	24(%rsp), %r8d
	movl	32(%rsp), %ecx
.L12:
	movq	8(%rsp), %rax
	leaq	68(%rsp), %r13
	leaq	64(%rsp), %r12
	movl	$0, 32(%r14)
	movq	%rax, 24(%r14)
	leal	-1(%r8), %eax
	movl	%eax, 52(%rsp)
	testl	%r8d, %r8d
	je	.L11
	movq	%r15, 8(%rsp)
	movq	%rbp, %r15
	movq	16(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	64(%rsp), %eax
	movslq	32(%r14), %rdi
	leal	-1(%rax), %esi
	movl	68(%rsp), %eax
	movslq	%esi, %r8
	movl	%esi, 4(%r15,%rdi,4)
	movq	8(%rsp), %rsi
	leal	-1(%rax), %edx
	leaq	0(%rbp,%r8,4), %r8
	movq	%rdi, %rax
	movl	%edx, (%r15,%rdi,4)
	movslq	%edx, %rdx
	movd	(%r8), %xmm0
	addl	$2, %eax
	leaq	0(%rbp,%rdx,4), %rdx
	movl	%edi, (%r8)
	movd	(%rdx), %xmm1
	movl	%eax, 32(%r14)
	movl	52(%rsp), %eax
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%rsi,%rdi,4)
	leal	1(%rdi), %esi
	movl	%esi, (%rdx)
	leal	-1(%rax), %edx
	movl	%edx, 52(%rsp)
	testl	%eax, %eax
	jne	.L10
	movq	%r15, %rbp
	movl	48(%rsp), %ecx
	movq	8(%rsp), %r15
.L11:
	leal	(%rcx,%rcx,4), %eax
	movl	$8, %esi
	leal	(%rcx,%rax,2), %r12d
	movslq	%r12d, %rdi
	call	calloc@PLT
	movq	%rax, %rbx
	testl	%r12d, %r12d
	jle	.L18
	movl	%r12d, %edx
	pxor	%xmm0, %xmm0
	shrl	%edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%rax,%rdx), %rdx
.L16:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L16
	movl	%r12d, %eax
	andl	$-2, %eax
	andl	$1, %r12d
	je	.L18
	movq	$0, (%rbx,%rax,8)
.L18:
	leaq	56(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	56(%rsp), %eax
	testl	%eax, %eax
	jle	.L51
	leaq	60(%rsp), %rax
	movq	%rbp, 8(%rsp)
	movl	$1, %r14d
	leaq	68(%rsp), %r13
	leaq	64(%rsp), %r12
	movq	%rax, %rbp
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r12, %rdx
	movq	%r13, %rcx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	48(%rsp), %r11d
	movl	64(%rsp), %eax
	movd	%r14d, %xmm0
	movl	60(%rsp), %edx
	movd	68(%rsp), %xmm2
	addl	$1, %r14d
	imull	%r11d, %eax
	punpckldq	%xmm2, %xmm0
	leal	-1(%rdx,%rax), %eax
	cltq
	movq	%xmm0, (%rbx,%rax,8)
	cmpl	%r14d, 56(%rsp)
	jge	.L14
	movq	8(%rsp), %rbp
.L20:
	testl	%r11d, %r11d
	jle	.L8
	leaq	8(%rbx), %rcx
	movslq	%r11d, %rax
	leal	(%r11,%r11,4), %r13d
	movl	$10, %r14d
	movq	%rcx, 32(%rsp)
	leal	-1(%r11), %ecx
	addl	%r13d, %r13d
	leal	(%r11,%r11,8), %esi
	movq	%rax, 40(%rsp)
	negq	%rax
	movslq	%r13d, %r13
	movq	%rcx, 24(%rsp)
	movq	%rax, %r10
	leal	(%r11,%r11), %eax
	movq	%r13, %r9
	movl	%eax, %r13d
	.p2align 4,,10
	.p2align 3
.L28:
	movq	24(%rsp), %rax
	movq	32(%rsp), %rdx
	leaq	(%rbx,%r9,8), %rcx
	leal	(%r11,%rsi), %r12d
	movq	16(%rsp), %rdi
	addq	%r9, %rax
	subq	40(%rsp), %r9
	leaq	(%rdx,%rax,8), %r8
	.p2align 4,,10
	.p2align 3
.L23:
	movl	(%rcx), %eax
	cmpl	%eax, (%rcx,%r10,8)
	jge	.L21
	movq	(%rcx), %rax
	movq	%rax, (%rcx,%r10,8)
.L21:
	movslq	(%rdi), %rax
	cmpl	$-1, %eax
	je	.L27
	movq	%rdi, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L22:
	movl	0(%rbp,%rax,4), %edx
	movl	(%rcx), %edi
	addl	%esi, %edx
	movslq	%edx, %rdx
	leaq	(%rbx,%rdx,8), %rdx
	cmpl	%edi, (%rdx)
	jge	.L25
	movq	(%rcx), %rdi
	movq	%rdi, (%rdx)
	movslq	(%r15,%rax,4), %rax
	cmpl	$-1, %eax
	jne	.L22
.L50:
	movq	8(%rsp), %rdi
.L27:
	addq	$8, %rcx
	addq	$4, %rdi
	cmpq	%rcx, %r8
	jne	.L23
	movl	%r12d, %esi
	subl	%r13d, %esi
	subl	$1, %r14d
	jne	.L28
	xorl	%ebp, %ebp
	leaq	.LC3(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L29:
	movl	4(%rbx,%rbp,8), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbp
	call	__printf_chk@PLT
	cmpl	%ebp, 48(%rsp)
	jg	.L29
.L8:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L52
	addq	$88, %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
.L25:
	.cfi_restore_state
	movslq	(%r15,%rax,4), %rax
	cmpl	$-1, %eax
	jne	.L22
	jmp	.L50
.L51:
	movl	48(%rsp), %r11d
	jmp	.L20
.L52:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE42:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB43:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE43:
	.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:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	newGraph
	.type	newGraph, @function
newGraph:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movslq	%esi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movslq	%edi, %rbx
	movd	%ebp, %xmm1
	movl	$40, %edi
	movd	%ebx, %xmm0
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, %r14
	call	malloc@PLT
	movl	$4, %esi
	movq	%rbp, %rdi
	movq	%rax, %r12
	call	calloc@PLT
	movl	$4, %esi
	movq	%rbp, %rdi
	movq	%rax, (%r12)
	call	calloc@PLT
	movl	$4, %esi
	movq	%rbx, %rdi
	movq	%rax, 8(%r12)
	call	calloc@PLT
	movq	%rax, 16(%r12)
	testl	%ebx, %ebx
	jle	.L2
	movq	%rax, %rdi
	leaq	0(,%rbx,4), %rdx
	movl	$255, %esi
	call	memset@PLT
.L2:
	popq	%rbx
	.cfi_def_cfa_offset 40
	movq	%r12, %rax
	popq	%rbp
	.cfi_def_cfa_offset 32
	movq	%r14, 24(%r12)
	movl	$0, 32(%r12)
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE39:
	.size	newGraph, .-newGraph
	.p2align 4
	.globl	freeGraph
	.type	freeGraph, @function
freeGraph:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rbp
	movq	(%rdi), %rdi
	call	free@PLT
	movq	8(%rbp), %rdi
	call	free@PLT
	movq	16(%rbp), %rdi
	call	free@PLT
	movq	%rbp, %rdi
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE40:
	.size	freeGraph, .-freeGraph
	.p2align 4
	.globl	addEdge
	.type	addEdge, @function
addEdge:
.LFB41:
	.cfi_startproc
	endbr64
	movslq	32(%rdi), %rcx
	movq	(%rdi), %rax
	movslq	%esi, %rsi
	movl	%edx, (%rax,%rcx,4)
	movq	16(%rdi), %rax
	leaq	(%rax,%rsi,4), %rax
	movq	8(%rdi), %rsi
	movl	(%rax), %r8d
	movl	%r8d, (%rsi,%rcx,4)
	movl	%ecx, (%rax)
	addl	$1, 32(%rdi)
	ret
	.cfi_endproc
.LFE41:
	.size	addEdge, .-addEdge
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB42:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	52(%rsp), %rdx
	leaq	48(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %r8d
	movl	48(%rsp), %ecx
	movl	$40, %edi
	leal	(%r8,%r8), %r12d
	movd	%ecx, %xmm3
	movl	%r8d, 32(%rsp)
	movd	%r12d, %xmm4
	movslq	%r12d, %r12
	movl	%ecx, 16(%rsp)
	punpckldq	%xmm4, %xmm3
	movq	%xmm3, 8(%rsp)
	call	malloc@PLT
	movl	$4, %esi
	movq	%r12, %rdi
	movq	%rax, %r14
	call	calloc@PLT
	movl	$4, %esi
	movq	%r12, %rdi
	movq	%rax, (%r14)
	movq	%rax, %rbp
	call	calloc@PLT
	movslq	16(%rsp), %r13
	movl	$4, %esi
	movq	%rax, 8(%r14)
	movq	%rax, %r15
	movq	%r13, %rdi
	movl	%r13d, 24(%rsp)
	call	calloc@PLT
	movl	24(%rsp), %ecx
	movl	32(%rsp), %r8d
	movq	%rax, 16(%rsp)
	testl	%ecx, %ecx
	movq	%rax, 16(%r14)
	jle	.L12
	movq	%rax, %rdi
	leaq	0(,%r13,4), %rdx
	movl	$255, %esi
	movl	%ecx, 32(%rsp)
	movl	%r8d, 24(%rsp)
	call	memset@PLT
	movl	24(%rsp), %r8d
	movl	32(%rsp), %ecx
.L12:
	movq	8(%rsp), %rax
	leaq	68(%rsp), %r13
	leaq	64(%rsp), %r12
	movl	$0, 32(%r14)
	movq	%rax, 24(%r14)
	leal	-1(%r8), %eax
	movl	%eax, 52(%rsp)
	testl	%r8d, %r8d
	je	.L11
	movq	%r15, 8(%rsp)
	movq	%rbp, %r15
	movq	16(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	64(%rsp), %eax
	movslq	32(%r14), %rdi
	leal	-1(%rax), %esi
	movl	68(%rsp), %eax
	movslq	%esi, %r8
	movl	%esi, 4(%r15,%rdi,4)
	movq	8(%rsp), %rsi
	leal	-1(%rax), %edx
	leaq	0(%rbp,%r8,4), %r8
	movq	%rdi, %rax
	movl	%edx, (%r15,%rdi,4)
	movslq	%edx, %rdx
	movd	(%r8), %xmm0
	addl	$2, %eax
	leaq	0(%rbp,%rdx,4), %rdx
	movl	%edi, (%r8)
	movd	(%rdx), %xmm1
	movl	%eax, 32(%r14)
	movl	52(%rsp), %eax
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%rsi,%rdi,4)
	leal	1(%rdi), %esi
	movl	%esi, (%rdx)
	leal	-1(%rax), %edx
	movl	%edx, 52(%rsp)
	testl	%eax, %eax
	jne	.L10
	movq	%r15, %rbp
	movl	48(%rsp), %ecx
	movq	8(%rsp), %r15
.L11:
	leal	(%rcx,%rcx,4), %eax
	movl	$8, %esi
	leal	(%rcx,%rax,2), %r12d
	movslq	%r12d, %rdi
	call	calloc@PLT
	movq	%rax, %rbx
	testl	%r12d, %r12d
	jle	.L18
	movl	%r12d, %edx
	pxor	%xmm0, %xmm0
	shrl	%edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%rax,%rdx), %rdx
.L16:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L16
	movl	%r12d, %eax
	andl	$-2, %eax
	andl	$1, %r12d
	je	.L18
	movq	$0, (%rbx,%rax,8)
.L18:
	leaq	56(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	56(%rsp), %eax
	testl	%eax, %eax
	jle	.L51
	leaq	60(%rsp), %rax
	movq	%rbp, 8(%rsp)
	movl	$1, %r14d
	leaq	68(%rsp), %r13
	leaq	64(%rsp), %r12
	movq	%rax, %rbp
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r12, %rdx
	movq	%r13, %rcx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	48(%rsp), %r11d
	movl	64(%rsp), %eax
	movd	%r14d, %xmm0
	movl	60(%rsp), %edx
	movd	68(%rsp), %xmm2
	addl	$1, %r14d
	imull	%r11d, %eax
	punpckldq	%xmm2, %xmm0
	leal	-1(%rdx,%rax), %eax
	cltq
	movq	%xmm0, (%rbx,%rax,8)
	cmpl	%r14d, 56(%rsp)
	jge	.L14
	movq	8(%rsp), %rbp
.L20:
	testl	%r11d, %r11d
	jle	.L8
	leaq	8(%rbx), %rcx
	movslq	%r11d, %rax
	leal	(%r11,%r11,4), %r13d
	movl	$10, %r14d
	movq	%rcx, 32(%rsp)
	leal	-1(%r11), %ecx
	addl	%r13d, %r13d
	leal	(%r11,%r11,8), %esi
	movq	%rax, 40(%rsp)
	negq	%rax
	movslq	%r13d, %r13
	movq	%rcx, 24(%rsp)
	movq	%rax, %r10
	leal	(%r11,%r11), %eax
	movq	%r13, %r9
	movl	%eax, %r13d
	.p2align 4,,10
	.p2align 3
.L28:
	movq	24(%rsp), %rax
	movq	32(%rsp), %rdx
	leaq	(%rbx,%r9,8), %rcx
	leal	(%r11,%rsi), %r12d
	movq	16(%rsp), %rdi
	addq	%r9, %rax
	subq	40(%rsp), %r9
	leaq	(%rdx,%rax,8), %r8
	.p2align 4,,10
	.p2align 3
.L23:
	movl	(%rcx), %eax
	cmpl	%eax, (%rcx,%r10,8)
	jge	.L21
	movq	(%rcx), %rax
	movq	%rax, (%rcx,%r10,8)
.L21:
	movslq	(%rdi), %rax
	cmpl	$-1, %eax
	je	.L27
	movq	%rdi, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L22:
	movl	0(%rbp,%rax,4), %edx
	movl	(%rcx), %edi
	addl	%esi, %edx
	movslq	%edx, %rdx
	leaq	(%rbx,%rdx,8), %rdx
	cmpl	%edi, (%rdx)
	jge	.L25
	movq	(%rcx), %rdi
	movq	%rdi, (%rdx)
	movslq	(%r15,%rax,4), %rax
	cmpl	$-1, %eax
	jne	.L22
.L50:
	movq	8(%rsp), %rdi
.L27:
	addq	$8, %rcx
	addq	$4, %rdi
	cmpq	%rcx, %r8
	jne	.L23
	movl	%r12d, %esi
	subl	%r13d, %esi
	subl	$1, %r14d
	jne	.L28
	xorl	%ebp, %ebp
	leaq	.LC3(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L29:
	movl	4(%rbx,%rbp,8), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbp
	call	__printf_chk@PLT
	cmpl	%ebp, 48(%rsp)
	jg	.L29
.L8:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L52
	addq	$88, %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
.L25:
	.cfi_restore_state
	movslq	(%r15,%rax,4), %rax
	cmpl	$-1, %eax
	jne	.L22
	jmp	.L50
.L51:
	movl	48(%rsp), %r11d
	jmp	.L20
.L52:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE42:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB43:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE43:
	.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:

#include<stdio.h>
#include<stdlib.h>

typedef struct directedGraph{
  int *vertex;
  int *next;
  int *start;
  int v,e;
  int pointer;
} graph;

graph* newGraph(const int v,const int e){
  graph *g=(graph *)malloc(sizeof(graph));
  g->vertex=(int *)calloc(e,sizeof(int));
  g->next=(int *)calloc(e,sizeof(int));
  g->start=(int *)calloc(v,sizeof(int));
  for(int i=0;i<v;i++) g->start[i]=-1;
  g->v=v;
  g->e=e;
  g->pointer=0;
  return g;
}

void freeGraph(graph *g){
  free(g->vertex);
  free(g->next);
  free(g->start);
  free(g);
  return;
}

void addEdge(graph *g,const int from,const int to){
  const int p=g->pointer;
  g->vertex[p]=to;
  g->next[p]=g->start[from];
  g->start[from]=p;
  g->pointer++;
  return;
}

typedef struct node{
  int t;
  int c;
} node;

#define POS(rad,v) ((rad)*n+(v))

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  graph *g=newGraph(n,2*m);
  while(m--){
    int a,b;
    scanf("%d%d",&a,&b);
    a--;b--;
    addEdge(g,a,b);
    addEdge(g,b,a);
  }
  const int f=10;
  node *dp=(node *)calloc(n*(f+1),sizeof(node));
  int i;
  for(i=0;i<(f+1)*n;i++) dp[i]=(node){0,0};
  int q;
  scanf("%d",&q);
  for(i=1;i<=q;i++){
    int v,d,c;
    scanf("%d%d%d",&v,&d,&c);
    v--;
    dp[POS(d,v)]=(node){i,c};
  }
  for(i=f;i>0;i--){
    for(int v=0;v<n;v++){
      if(dp[POS(i-1,v)].t<dp[POS(i,v)].t) dp[POS(i-1,v)]=dp[POS(i,v)];
      for(int p=g->start[v];p!=-1;p=g->next[p]){
	int u=g->vertex[p];
	if(dp[POS(i-1,u)].t<dp[POS(i,v)].t){
	  dp[POS(i-1,u)]=dp[POS(i,v)];
	}
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d\n",dp[POS(0,i)].c);
  }
}

int main(void){
  run();
  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>

typedef struct directedGraph{
  int *vertex;
  int *next;
  int *start;
  int v,e;
  int pointer;
} graph;

graph* newGraph(const int v,const int e){
  graph *g=(graph *)malloc(sizeof(graph));
  g->vertex=(int *)calloc(e,sizeof(int));
  g->next=(int *)calloc(e,sizeof(int));
  g->start=(int *)calloc(v,sizeof(int));
  for(int i=0;i<v;i++) g->start[i]=-1;
  g->v=v;
  g->e=e;
  g->pointer=0;
  return g;
}

void freeGraph(graph *g){
  free(g->vertex);
  free(g->next);
  free(g->start);
  free(g);
  return;
}

void addEdge(graph *g,const int from,const int to){
  const int p=g->pointer;
  g->vertex[p]=to;
  g->next[p]=g->start[from];
  g->start[from]=p;
  g->pointer++;
  return;
}

typedef struct node{
  int t;
  int c;
} node;

#define POS(rad,v) ((rad)*n+(v))

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  graph *g=newGraph(n,2*m);
  while(m--){
    int a,b;
    scanf("%d%d",&a,&b);
    a--;b--;
    addEdge(g,a,b);
    addEdge(g,b,a);
  }
  const int f=10;
  node *dp=(node *)calloc(n*(f+1),sizeof(node));
  int i;
  for(i=0;i<(f+1)*n;i++) dp[i]=(node){0,0};
  int q;
  scanf("%d",&q);
  for(i=1;i<=q;i++){
    int v,d,c;
    scanf("%d%d%d",&v,&d,&c);
    v--;
    dp[POS(d,v)]=(node){i,c};
  }
  for(i=f;i>0;i--){
    for(int v=0;v<n;v++){
      if(dp[POS(i-1,v)].t<dp[POS(i,v)].t) dp[POS(i-1,v)]=dp[POS(i,v)];
      for(int p=g->start[v];p!=-1;p=g->next[p]){
	int u=g->vertex[p];
	if(dp[POS(i-1,u)].t<dp[POS(i,v)].t){
	  dp[POS(i-1,u)]=dp[POS(i,v)];
	}
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d\n",dp[POS(0,i)].c);
  }
}

int main(void){
  run();
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	newGraph
	.type	newGraph, @function
newGraph:
.LFB6:
	.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	$40, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movl	-24(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, (%rax)
	movl	-24(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
	movl	-20(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 16(%rax)
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	movq	-8(%rbp), %rax
	movq	16(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -12(%rbp)
.L2:
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L3
	movq	-8(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, 24(%rax)
	movq	-8(%rbp), %rax
	movl	-24(%rbp), %edx
	movl	%edx, 28(%rax)
	movq	-8(%rbp), %rax
	movl	$0, 32(%rax)
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	newGraph, .-newGraph
	.globl	freeGraph
	.type	freeGraph, @function
freeGraph:
.LFB7:
	.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
	movq	%rdi, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	freeGraph, .-freeGraph
	.globl	addEdge
	.type	addEdge, @function
addEdge:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movq	-24(%rbp), %rax
	movl	32(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	movq	16(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	movq	-24(%rbp), %rax
	movq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	movq	16(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	movl	32(%rax), %eax
	leal	1(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 32(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	addEdge, .-addEdge
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rdx
	leaq	-68(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-68(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	newGraph
	movq	%rax, -24(%rbp)
	jmp	.L10
.L11:
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -52(%rbp)
	movl	-48(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -48(%rbp)
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	addEdge
	movl	-52(%rbp), %edx
	movl	-48(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	addEdge
.L10:
	movl	-64(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -64(%rbp)
	testl	%eax, %eax
	jne	.L11
	movl	$10, -32(%rbp)
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	-68(%rbp), %eax
	imull	%edx, %eax
	cltq
	movl	$8, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L12
.L13:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movl	$0, 4(%rax)
	addl	$1, -44(%rbp)
.L12:
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	-68(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -44(%rbp)
	jl	.L13
	leaq	-60(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -44(%rbp)
	jmp	.L14
.L15:
	leaq	-48(%rbp), %rcx
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -56(%rbp)
	movl	-52(%rbp), %edx
	movl	-68(%rbp), %eax
	imull	%eax, %edx
	movl	-56(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %ecx
	movl	%ecx, (%rax)
	movl	%edx, 4(%rax)
	addl	$1, -44(%rbp)
.L14:
	movl	-60(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L15
	movl	-32(%rbp), %eax
	movl	%eax, -44(%rbp)
	jmp	.L16
.L23:
	movl	$0, -40(%rbp)
	jmp	.L17
.L22:
	movl	-44(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-68(%rbp), %eax
	imull	%eax, %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-68(%rbp), %eax
	imull	-44(%rbp), %eax
	movl	%eax, %ecx
	movl	-40(%rbp), %eax
	addl	%ecx, %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L18
	movl	-68(%rbp), %eax
	imull	-44(%rbp), %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	-44(%rbp), %edx
	leal	-1(%rdx), %ecx
	movl	-68(%rbp), %edx
	imull	%edx, %ecx
	movl	-40(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
.L18:
	movq	-24(%rbp), %rax
	movq	16(%rax), %rdx
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -36(%rbp)
	jmp	.L19
.L21:
	movq	-24(%rbp), %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -28(%rbp)
	movl	-44(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-68(%rbp), %eax
	imull	%eax, %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-68(%rbp), %eax
	imull	-44(%rbp), %eax
	movl	%eax, %ecx
	movl	-40(%rbp), %eax
	addl	%ecx, %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L20
	movl	-68(%rbp), %eax
	imull	-44(%rbp), %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	-44(%rbp), %edx
	leal	-1(%rdx), %ecx
	movl	-68(%rbp), %edx
	imull	%edx, %ecx
	movl	-28(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
.L20:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -36(%rbp)
.L19:
	cmpl	$-1, -36(%rbp)
	jne	.L21
	addl	$1, -40(%rbp)
.L17:
	movl	-68(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L22
	subl	$1, -44(%rbp)
.L16:
	cmpl	$0, -44(%rbp)
	jg	.L23
	movl	$0, -44(%rbp)
	jmp	.L24
.L25:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -44(%rbp)
.L24:
	movl	-68(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L25
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	run, .-run
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	call	run
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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	newGraph
	.type	newGraph, @function
newGraph:
.LFB6:
	.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	$40, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movl	-24(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, (%rax)
	movl	-24(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
	movl	-20(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 16(%rax)
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	movq	-8(%rbp), %rax
	movq	16(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -12(%rbp)
.L2:
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L3
	movq	-8(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, 24(%rax)
	movq	-8(%rbp), %rax
	movl	-24(%rbp), %edx
	movl	%edx, 28(%rax)
	movq	-8(%rbp), %rax
	movl	$0, 32(%rax)
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	newGraph, .-newGraph
	.globl	freeGraph
	.type	freeGraph, @function
freeGraph:
.LFB7:
	.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
	movq	%rdi, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	freeGraph, .-freeGraph
	.globl	addEdge
	.type	addEdge, @function
addEdge:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movq	-24(%rbp), %rax
	movl	32(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	movq	16(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	movq	-24(%rbp), %rax
	movq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	movq	16(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	movl	32(%rax), %eax
	leal	1(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 32(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	addEdge, .-addEdge
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rdx
	leaq	-68(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-68(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	newGraph
	movq	%rax, -24(%rbp)
	jmp	.L10
.L11:
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -52(%rbp)
	movl	-48(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -48(%rbp)
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	addEdge
	movl	-52(%rbp), %edx
	movl	-48(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	addEdge
.L10:
	movl	-64(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -64(%rbp)
	testl	%eax, %eax
	jne	.L11
	movl	$10, -32(%rbp)
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	-68(%rbp), %eax
	imull	%edx, %eax
	cltq
	movl	$8, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L12
.L13:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movl	$0, 4(%rax)
	addl	$1, -44(%rbp)
.L12:
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	-68(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -44(%rbp)
	jl	.L13
	leaq	-60(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -44(%rbp)
	jmp	.L14
.L15:
	leaq	-48(%rbp), %rcx
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -56(%rbp)
	movl	-52(%rbp), %edx
	movl	-68(%rbp), %eax
	imull	%eax, %edx
	movl	-56(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %ecx
	movl	%ecx, (%rax)
	movl	%edx, 4(%rax)
	addl	$1, -44(%rbp)
.L14:
	movl	-60(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L15
	movl	-32(%rbp), %eax
	movl	%eax, -44(%rbp)
	jmp	.L16
.L23:
	movl	$0, -40(%rbp)
	jmp	.L17
.L22:
	movl	-44(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-68(%rbp), %eax
	imull	%eax, %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-68(%rbp), %eax
	imull	-44(%rbp), %eax
	movl	%eax, %ecx
	movl	-40(%rbp), %eax
	addl	%ecx, %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L18
	movl	-68(%rbp), %eax
	imull	-44(%rbp), %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	-44(%rbp), %edx
	leal	-1(%rdx), %ecx
	movl	-68(%rbp), %edx
	imull	%edx, %ecx
	movl	-40(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
.L18:
	movq	-24(%rbp), %rax
	movq	16(%rax), %rdx
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -36(%rbp)
	jmp	.L19
.L21:
	movq	-24(%rbp), %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -28(%rbp)
	movl	-44(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-68(%rbp), %eax
	imull	%eax, %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-68(%rbp), %eax
	imull	-44(%rbp), %eax
	movl	%eax, %ecx
	movl	-40(%rbp), %eax
	addl	%ecx, %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L20
	movl	-68(%rbp), %eax
	imull	-44(%rbp), %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	-44(%rbp), %edx
	leal	-1(%rdx), %ecx
	movl	-68(%rbp), %edx
	imull	%edx, %ecx
	movl	-28(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
.L20:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -36(%rbp)
.L19:
	cmpl	$-1, -36(%rbp)
	jne	.L21
	addl	$1, -40(%rbp)
.L17:
	movl	-68(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L22
	subl	$1, -44(%rbp)
.L16:
	cmpl	$0, -44(%rbp)
	jg	.L23
	movl	$0, -44(%rbp)
	jmp	.L24
.L25:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -44(%rbp)
.L24:
	movl	-68(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L25
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	run, .-run
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	call	run
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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:
