#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *, int *);
int /*<<< orphan*/ stdin;
int main() {
  int array[502], N, M, num1, num2;
  freopen("data.in", "r", stdin);
  while (scanf("%d %d", &N, &M) != EOF) {
    for (int i = 0; i <= 501; i++)
      array[i] = i;
    for (int i = 0; i < M; i++) {
      scanf("%d %d", &num1, &num2);
      if (num1 < num2)
        continue;
      int tmp = array[num1];
      array[num1] = array[num2];
      array[num2] = tmp;
    }
    for (int i = 1; i <= N; i++) {
      if (i != N)
        printf("%d ", array[i]);
      else
        printf("%d\n", array[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9f(%rip),%rax
mov    (%rax),%edx
lea    0xeae(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <freopen@plt>
lea    0xea5(%rip),%rdi
lea    -0x7e4(%rbp),%rsi
lea    -0x7e8(%rbp),%rdx
call   1050 <scanf@plt>
mov    0x2e61(%rip),%rcx
cmp    (%rcx),%rax
je     12f4 <main+0x1c4>
movl   $0x0,-0x7f4(%rbp)
cmpl   $0x1f5,-0x7f4(%rbp)
jg     11ca <main+0x9a>
mov    -0x7f4(%rbp),%ecx
movslq -0x7f4(%rbp),%rax
mov    %ecx,-0x7e0(%rbp,%rax,4)
mov    -0x7f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f4(%rbp)
jmp    1192 <main+0x62>
movl   $0x0,-0x7f8(%rbp)
mov    -0x7f8(%rbp),%eax
cmp    -0x7e8(%rbp),%eax
jge    126f <main+0x13f>
lea    0xe1d(%rip),%rdi
lea    -0x7ec(%rbp),%rsi
lea    -0x7f0(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x7ec(%rbp),%eax
cmp    -0x7f0(%rbp),%eax
jge    1217 <main+0xe7>
jmp    125b <main+0x12b>
movslq -0x7ec(%rbp),%rax
mov    -0x7e0(%rbp,%rax,4),%eax
mov    %eax,-0x7fc(%rbp)
movslq -0x7f0(%rbp),%rax
mov    -0x7e0(%rbp,%rax,4),%ecx
movslq -0x7ec(%rbp),%rax
mov    %ecx,-0x7e0(%rbp,%rax,4)
mov    -0x7fc(%rbp),%ecx
movslq -0x7f0(%rbp),%rax
mov    %ecx,-0x7e0(%rbp,%rax,4)
mov    -0x7f8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f8(%rbp)
jmp    11d4 <main+0xa4>
movl   $0x1,-0x800(%rbp)
mov    -0x800(%rbp),%eax
cmp    -0x7e4(%rbp),%eax
jg     12ef <main+0x1bf>
mov    -0x800(%rbp),%eax
cmp    -0x7e4(%rbp),%eax
je     12bc <main+0x18c>
movslq -0x800(%rbp),%rax
mov    -0x7e0(%rbp,%rax,4),%esi
lea    0xd5e(%rip),%rdi
call   1030 <printf@plt>
jmp    12d6 <main+0x1a6>
movslq -0x800(%rbp),%rax
mov    -0x7e0(%rbp,%rax,4),%esi
lea    0xd43(%rip),%rdi
call   1030 <printf@plt>
jmp    12db <main+0x1ab>
mov    -0x800(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x800(%rbp)
jmp    1279 <main+0x149>
jmp    115e <main+0x2e>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7e8,%rsp
mov    0x2ea0(%rip),%rax
mov    (%rax),%edx
lea    0xeef(%rip),%rdi
lea    0xef0(%rip),%rsi
call   1040 <freopen@plt>
lea    0xee6(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x2e68(%rip),%rcx
cmp    (%rcx),%rax
jne    1191 <main+0x61>
xor    %eax,%eax
add    $0x7e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movdqa 0xe67(%rip),%xmm0
xor    %ecx,%ecx
movdqa 0xe6d(%rip),%xmm2
movdqa 0xe75(%rip),%xmm3
lea    0xe98(%rip),%rbx
lea    0xc(%rsp),%rbp
lea    0x8(%rsp),%r15
lea    0xe91(%rip),%r14
lea    0xe86(%rip),%r12
jmp    1210 <main+0xe0>
nopl   0x0(%rax)
mov    %rbx,%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    $0x0,%ecx
movdqa 0xe13(%rip),%xmm0
mov    0x2dec(%rip),%rdx
cmp    (%rdx),%rax
movdqa 0xe11(%rip),%xmm2
movdqa 0xe19(%rip),%xmm3
mov    %r13,%rbp
je     117d <main+0x4d>
movdqa %xmm0,%xmm1
paddd  %xmm2,%xmm1
movdqa %xmm0,0x10(%rsp,%rcx,4)
movdqa %xmm1,0x20(%rsp,%rcx,4)
add    $0x8,%rcx
paddd  %xmm3,%xmm0
cmp    $0x1f0,%rcx
jne    1210 <main+0xe0>
movdqa 0xdf3(%rip),%xmm0
movdqa %xmm0,0x7d0(%rsp)
movabs $0x1f5000001f4,%rax
mov    %rax,0x7e0(%rsp)
cmpl   $0x0,(%rsp)
jle    12b0 <main+0x180>
xor    %r13d,%r13d
jmp    127a <main+0x14a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r13d
cmp    (%rsp),%r13d
jge    12b0 <main+0x180>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
call   1050 <scanf@plt>
movslq 0xc(%rsp),%rax
movslq 0x8(%rsp),%rcx
cmp    %ecx,%eax
jl     1270 <main+0x140>
mov    0x10(%rsp,%rax,4),%edx
mov    0x10(%rsp,%rcx,4),%esi
mov    %esi,0x10(%rsp,%rax,4)
mov    %edx,0x10(%rsp,%rcx,4)
jmp    1270 <main+0x140>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%r13
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11d0 <main+0xa0>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,%eax
cmp    %rax,%rbp
mov    0x10(%rsp,%rbp,4),%esi
mov    %r12,%rdi
cmove  %r14,%rdi
call   1030 <printf@plt>
lea    0x1(%rbp),%rcx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbp
mov    %rcx,%rbp
jl     12d0 <main+0x1a0>
jmp    11d0 <main+0xa0>

LLVM IR (-O0):
@.str = [8 x i8] c"data.in\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [6 x i8] c"%d %d\00"
@EOF = global i64 0
@.str.3 = [4 x i8] c"%d \00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [502 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = load i32, i32* @stdin
%12 = call i32 @freopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %84, %0
%14 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4)
%15 = load i64, i64* @EOF
%16 = icmp ne i64 %14, %15
br i1 %16, label %17, label %85
17: ; preds = %13
store i32 0, i32* %7
br label %18
18: ; preds = %26, %17
%19 = load i32, i32* %7
%20 = icmp sle i32 %19, 501
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = load i32, i32* %7
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [502 x i32], [502 x i32]* %2, i64 0, i64 %24
store i32 %22, i32* %25
br label %26
26: ; preds = %21
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %18
29: ; preds = %18
store i32 0, i32* %8
br label %30
30: ; preds = %56, %29
%31 = load i32, i32* %8
%32 = load i32, i32* %4
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %59
34: ; preds = %30
%35 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32* %6)
%36 = load i32, i32* %5
%37 = load i32, i32* %6
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %40
39: ; preds = %34
br label %56
40: ; preds = %34
%41 = load i32, i32* %5
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [502 x i32], [502 x i32]* %2, i64 0, i64 %42
%44 = load i32, i32* %43
store i32 %44, i32* %9
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [502 x i32], [502 x i32]* %2, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = load i32, i32* %5
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [502 x i32], [502 x i32]* %2, i64 0, i64 %50
store i32 %48, i32* %51
%52 = load i32, i32* %9
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [502 x i32], [502 x i32]* %2, i64 0, i64 %54
store i32 %52, i32* %55
br label %56
56: ; preds = %40, %39
%57 = load i32, i32* %8
%58 = add nsw i32 %57, 1
store i32 %58, i32* %8
br label %30
59: ; preds = %30
store i32 1, i32* %10
br label %60
60: ; preds = %81, %59
%61 = load i32, i32* %10
%62 = load i32, i32* %3
%63 = icmp sle i32 %61, %62
br i1 %63, label %64, label %84
64: ; preds = %60
%65 = load i32, i32* %10
%66 = load i32, i32* %3
%67 = icmp ne i32 %65, %66
br i1 %67, label %68, label %74
68: ; preds = %64
%69 = load i32, i32* %10
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [502 x i32], [502 x i32]* %2, i64 0, i64 %70
%72 = load i32, i32* %71
%73 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %72)
br label %80
74: ; preds = %64
%75 = load i32, i32* %10
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [502 x i32], [502 x i32]* %2, i64 0, i64 %76
%78 = load i32, i32* %77
%79 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %78)
br label %80
80: ; preds = %74, %68
br label %81
81: ; preds = %80
%82 = load i32, i32* %10
%83 = add nsw i32 %82, 1
store i32 %83, i32* %10
br label %60
84: ; preds = %60
br label %13
85: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"data.in\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [6 x i8] c"%d %d\00"
@EOF = global i64 0
@.str.3 = [4 x i8] c"%d \00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [502 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [502 x i32]* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = load i32, i32* @stdin
%12 = tail call i32 @freopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %2, i32* %3)
%14 = load i64, i64* @EOF
%15 = icmp eq i64 %13, %14
br i1 %15, label %77, label %16
16: ; preds = %0
%17 = getelementptr inbounds [502 x i32], [502 x i32]* %1, i64 0, i64 496
%18 = getelementptr inbounds [502 x i32], [502 x i32]* %1, i64 0, i64 497
%19 = getelementptr inbounds [502 x i32], [502 x i32]* %1, i64 0, i64 498
%20 = getelementptr inbounds [502 x i32], [502 x i32]* %1, i64 0, i64 499
%21 = getelementptr inbounds [502 x i32], [502 x i32]* %1, i64 0, i64 500
%22 = getelementptr inbounds [502 x i32], [502 x i32]* %1, i64 0, i64 501
br label %27
23: ; preds = %64, %44
%24 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %2, i32* %3)
%25 = load i64, i64* @EOF
%26 = icmp eq i64 %24, %25
br i1 %26, label %77, label %38
27: ; preds = %38, %16
%28 = phi i64 [ 0, %16 ], [ %39, %38 ]
%29 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %16 ], [ %40, %38 ]
%30 = add <4 x i32> %29, <i32 4, i32 4, i32 4, i32 4>
%31 = getelementptr inbounds [502 x i32], [502 x i32]* %1, i64 0, i64 %28
%32 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> %29, <4 x i32>* %32
%33 = getelementptr inbounds i32, i32* %31, i64 4
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> %30, <4 x i32>* %34
%35 = add nuw i64 %28, 8
%36 = add <4 x i32> %29, <i32 8, i32 8, i32 8, i32 8>
%37 = icmp eq i64 %35, 496
br i1 %37, label %41, label %38
38: ; preds = %27, %23
%39 = phi i64 [ %35, %27 ], [ 0, %23 ]
%40 = phi <4 x i32> [ %36, %27 ], [ <i32 0, i32 1, i32 2, i32 3>, %23 ]
br label %27
41: ; preds = %27
store i32 496, i32* %17
store i32 497, i32* %18
store i32 498, i32* %19
store i32 499, i32* %20
store i32 500, i32* %21
store i32 501, i32* %22
%42 = load i32, i32* %3
%43 = icmp sgt i32 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %60, %41
%45 = load i32, i32* %2
%46 = icmp slt i32 %45, 1
br i1 %46, label %23, label %64
47: ; preds = %41, %60
%48 = phi i32 [ %61, %60 ], [ 0, %41 ]
%49 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %4, i32* %5)
%50 = load i32, i32* %4
%51 = load i32, i32* %5
%52 = icmp slt i32 %50, %51
br i1 %52, label %60, label %53
53: ; preds = %47
%54 = sext i32 %50 to i64
%55 = getelementptr inbounds [502 x i32], [502 x i32]* %1, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = sext i32 %51 to i64
%58 = getelementptr inbounds [502 x i32], [502 x i32]* %1, i64 0, i64 %57
%59 = load i32, i32* %58
store i32 %59, i32* %55
store i32 %56, i32* %58
br label %60
60: ; preds = %47, %53
%61 = add nuw nsw i32 %48, 1
%62 = load i32, i32* %3
%63 = icmp slt i32 %61, %62
br i1 %63, label %47, label %44
64: ; preds = %44, %64
%65 = phi i64 [ %73, %64 ], [ 1, %44 ]
%66 = phi i32 [ %74, %64 ], [ %45, %44 ]
%67 = zext i32 %66 to i64
%68 = icmp eq i64 %65, %67
%69 = getelementptr inbounds [502 x i32], [502 x i32]* %1, i64 0, i64 %65
%70 = load i32, i32* %69
%71 = select i1 %68, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%72 = call i32 @printf(i8* %71, i32 %70)
%73 = add nuw nsw i64 %65, 1
%74 = load i32, i32* %2
%75 = sext i32 %74 to i64
%76 = icmp slt i64 %65, %75
br i1 %76, label %64, label %23
77: ; preds = %23, %0
ret i32 0
}