#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__ isalpha(char);
int /*<<< orphan*/ printf(char *, char *, char *);
scalar_t__ scanf(char *, char *, char *);
scalar_t__ tolower_(char);
int main() {
  int t;
  char s1[10001] = {0}, s2[10001] = {0};
  while (scanf("%s%s", s1, s2) > 0) {
    int i = 0;
    while (s1[i] == s2[i] && i < 10001)
      i++;
    if (isalpha(s1[i]) && isalpha(s2[i])) {
      if (tolower_(s1[i]) == tolower_(s2[i])) {
        if (s1[i] > s2[i])
          printf("%s %s\n", s2, s1);
        else
          printf("%s %s\n", s1, s2);
      } else if (tolower_(s1[i]) > tolower_(s2[i]))
        printf("%s %s\n", s2, s1);
      else
        printf("%s %s\n", s1, s2);
    } else if (s1[i] > s2[i])
      printf("%s %s\n", s2, s1);
    else
      printf("%s %s\n", s1, s2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x2720(%rbp),%rdi
xor    %esi,%esi
mov    $0x2711,%edx
call   1040 <memset@plt>
lea    -0x4e40(%rbp),%rdi
xor    %esi,%esi
mov    $0x2711,%edx
call   1040 <memset@plt>
lea    -0x2720(%rbp),%rsi
lea    -0x4e40(%rbp),%rdx
lea    0xe63(%rip),%rdi
call   1070 <scanf@plt>
cmp    $0x0,%rax
jle    13ee <main+0x29e>
movl   $0x0,-0x4e44(%rbp)
movslq -0x4e44(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%ecx
ff
movslq -0x4e44(%rbp),%rax
movsbl -0x4e40(%rbp,%rax,1),%edx
ff
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x4e45(%rbp)
jne    11f7 <main+0xa7>
cmpl   $0x2711,-0x4e44(%rbp)
setl   %al
mov    %al,-0x4e45(%rbp)
mov    -0x4e45(%rbp),%al
test   $0x1,%al
jne    120a <main+0xba>
jmp    121e <main+0xce>
mov    -0x4e44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e44(%rbp)
jmp    11b6 <main+0x66>
movslq -0x4e44(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%edi
ff
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     1385 <main+0x235>
movslq -0x4e44(%rbp),%rax
movsbl -0x4e40(%rbp,%rax,1),%edi
ff
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     1385 <main+0x235>
movslq -0x4e44(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%edi
ff
call   1050 <tolower_@plt>
mov    %rax,-0x4e50(%rbp)
movslq -0x4e44(%rbp),%rax
movsbl -0x4e40(%rbp,%rax,1),%edi
ff
call   1050 <tolower_@plt>
mov    %rax,%rcx
mov    -0x4e50(%rbp),%rax
cmp    %rcx,%rax
jne    1300 <main+0x1b0>
movslq -0x4e44(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%eax
ff
movslq -0x4e44(%rbp),%rcx
movsbl -0x4e40(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jle    12e1 <main+0x191>
lea    -0x4e40(%rbp),%rsi
lea    -0x2720(%rbp),%rdx
lea    0xd2e(%rip),%rdi
call   1030 <printf@plt>
jmp    12fb <main+0x1ab>
lea    -0x2720(%rbp),%rsi
lea    -0x4e40(%rbp),%rdx
lea    0xd0f(%rip),%rdi
call   1030 <printf@plt>
jmp    1380 <main+0x230>
movslq -0x4e44(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%edi
ff
call   1050 <tolower_@plt>
mov    %rax,-0x4e58(%rbp)
movslq -0x4e44(%rbp),%rax
movsbl -0x4e40(%rbp,%rax,1),%edi
ff
call   1050 <tolower_@plt>
mov    %rax,%rcx
mov    -0x4e58(%rbp),%rax
cmp    %rcx,%rax
jle    1361 <main+0x211>
lea    -0x4e40(%rbp),%rsi
lea    -0x2720(%rbp),%rdx
lea    0xcae(%rip),%rdi
call   1030 <printf@plt>
jmp    137b <main+0x22b>
lea    -0x2720(%rbp),%rsi
lea    -0x4e40(%rbp),%rdx
lea    0xc8f(%rip),%rdi
call   1030 <printf@plt>
jmp    1380 <main+0x230>
jmp    13e9 <main+0x299>
movslq -0x4e44(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%eax
ff
movslq -0x4e44(%rbp),%rcx
movsbl -0x4e40(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jle    13ca <main+0x27a>
lea    -0x4e40(%rbp),%rsi
lea    -0x2720(%rbp),%rdx
lea    0xc45(%rip),%rdi
call   1030 <printf@plt>
jmp    13e4 <main+0x294>
lea    -0x2720(%rbp),%rsi
lea    -0x4e40(%rbp),%rdx
lea    0xc26(%rip),%rdi
call   1030 <printf@plt>
jmp    13e9 <main+0x299>
jmp    1188 <main+0x38>
xor    %eax,%eax
add    $0x4e60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4e38,%rsp
lea    0x2720(%rsp),%r14
mov    $0x2711,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rsp,%rbx
mov    $0x2711,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xe6f(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1070 <scanf@plt>
test   %rax,%rax
jle    12ae <main+0x15e>
xor    %ecx,%ecx
lea    0xe57(%rip),%r14
mov    %rsp,%r15
lea    0x2720(%rsp),%r13
lea    0xe40(%rip),%r12
jmp    11fa <main+0xaa>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1070 <scanf@plt>
mov    $0x0,%ecx
test   %rax,%rax
jle    12ae <main+0x15e>
mov    %rcx,%rbp
movzbl 0x2720(%rsp,%rcx,1),%eax
cmp    (%rsp,%rcx,1),%al
jne    1217 <main+0xc7>
lea    0x1(%rbp),%rcx
cmp    $0x2711,%rbp
jb     11fa <main+0xaa>
movsbl %al,%edi
call   1060 <isalpha@plt>
test   %rax,%rax
je     1270 <main+0x120>
movsbl (%rsp,%rbp,1),%edi
call   1060 <isalpha@plt>
test   %rax,%rax
je     1270 <main+0x120>
movsbl 0x2720(%rsp,%rbp,1),%edi
call   1050 <tolower_@plt>
mov    %rax,%rbx
movsbl (%rsp,%rbp,1),%edi
call   1050 <tolower_@plt>
movzbl 0x2720(%rsp,%rbp,1),%ecx
cmp    %rax,%rbx
jne    1283 <main+0x133>
cmp    (%rsp,%rbp,1),%cl
jle    11d0 <main+0x80>
jmp    12a0 <main+0x150>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl 0x2720(%rsp,%rbp,1),%eax
cmp    (%rsp,%rbp,1),%al
jle    11d0 <main+0x80>
jmp    12a0 <main+0x150>
movsbl %cl,%edi
call   1050 <tolower_@plt>
mov    %rax,%rbx
movsbl (%rsp,%rbp,1),%edi
call   1050 <tolower_@plt>
cmp    %rax,%rbx
jle    11d0 <main+0x80>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
jmp    11d9 <main+0x89>
xor    %eax,%eax
add    $0x4e38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [7 x i8] c"%s %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10001 x i8]
%4 = alloca [10001 x i8]
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [10001 x i8]* %3 to i8*
%7 = bitcast [10001 x i8]* %4 to i8*
br label %8
8: ; preds = %124, %0
%9 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 0
%11 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10)
%12 = icmp sgt i64 %11, 0
br i1 %12, label %13, label %125
13: ; preds = %8
store i32 0, i32* %5
br label %14
14: ; preds = %31, %13
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %19, %24
br i1 %25, label %26, label %29
26: ; preds = %14
%27 = load i32, i32* %5
%28 = icmp slt i32 %27, 10001
br label %29
29: ; preds = %26, %14
%30 = phi i1 [ false, %14 ], [ %28, %26 ]
br i1 %30, label %31, label %34
31: ; preds = %29
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %14
34: ; preds = %29
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = call i64 @isalpha(i8 signext %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %103
41: ; preds = %34
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = call i64 @isalpha(i8 signext %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %103
48: ; preds = %41
%49 = load i32, i32* %5
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = call i64 @tolower_(i8 signext %52)
%54 = load i32, i32* %5
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 %55
%57 = load i8, i8* %56
%58 = call i64 @tolower_(i8 signext %57)
%59 = icmp eq i64 %53, %58
br i1 %59, label %60, label %81
60: ; preds = %48
%61 = load i32, i32* %5
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 %62
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = load i32, i32* %5
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp sgt i32 %65, %70
br i1 %71, label %72, label %76
72: ; preds = %60
%73 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 0
%74 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 0
%75 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %73, i8* %74)
br label %80
76: ; preds = %60
%77 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 0
%78 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 0
%79 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %77, i8* %78)
br label %80
80: ; preds = %76, %72
br label %102
81: ; preds = %48
%82 = load i32, i32* %5
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 %83
%85 = load i8, i8* %84
%86 = call i64 @tolower_(i8 signext %85)
%87 = load i32, i32* %5
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 %88
%90 = load i8, i8* %89
%91 = call i64 @tolower_(i8 signext %90)
%92 = icmp sgt i64 %86, %91
br i1 %92, label %93, label %97
93: ; preds = %81
%94 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 0
%95 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 0
%96 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %94, i8* %95)
br label %101
97: ; preds = %81
%98 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 0
%99 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 0
%100 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %98, i8* %99)
br label %101
101: ; preds = %97, %93
br label %102
102: ; preds = %101, %80
br label %124
103: ; preds = %41, %34
%104 = load i32, i32* %5
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 %105
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = load i32, i32* %5
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 %110
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = icmp sgt i32 %108, %113
br i1 %114, label %115, label %119
115: ; preds = %103
%116 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 0
%117 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 0
%118 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %116, i8* %117)
br label %123
119: ; preds = %103
%120 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 0
%121 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 0
%122 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %120, i8* %121)
br label %123
123: ; preds = %119, %115
br label %124
124: ; preds = %123, %102
br label %8
125: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [7 x i8] c"%s %s\0A\00"
define i32 @main() {
%1 = alloca [10001 x i8]
%2 = alloca [10001 x i8]
%3 = getelementptr inbounds [10001 x i8], [10001 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10001 x i8], [10001 x i8]* %2, i64 0, i64 0
%5 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %62
7: ; preds = %0, %17
%8 = phi i64 [ %18, %17 ], [ 0, %0 ]
%9 = getelementptr inbounds [10001 x i8], [10001 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = getelementptr inbounds [10001 x i8], [10001 x i8]* %2, i64 0, i64 %8
%12 = load i8, i8* %11
%13 = icmp eq i8 %10, %12
%14 = icmp ult i64 %8, 10001
%15 = select i1 %13, i1 %14, i1 false
%16 = add nuw nsw i64 %8, 1
br i1 %15, label %17, label %19
17: ; preds = %7, %59
%18 = phi i64 [ %16, %7 ], [ 0, %59 ]
br label %7
19: ; preds = %7
%20 = getelementptr inbounds [10001 x i8], [10001 x i8]* %1, i64 0, i64 %8
%21 = getelementptr inbounds [10001 x i8], [10001 x i8]* %2, i64 0, i64 %8
%22 = call i64 @isalpha(i8 signext %10)
%23 = icmp eq i64 %22, 0
br i1 %23, label %51, label %24
24: ; preds = %19
%25 = load i8, i8* %21
%26 = call i64 @isalpha(i8 signext %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %51, label %28
28: ; preds = %24
%29 = load i8, i8* %20
%30 = call i64 @tolower_(i8 signext %29)
%31 = load i8, i8* %21
%32 = call i64 @tolower_(i8 signext %31)
%33 = icmp eq i64 %30, %32
%34 = load i8, i8* %20
br i1 %33, label %35, label %42
35: ; preds = %28
%36 = load i8, i8* %21
%37 = icmp sgt i8 %34, %36
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* %3)
br label %59
40: ; preds = %35
%41 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %4)
br label %59
42: ; preds = %28
%43 = call i64 @tolower_(i8 signext %34)
%44 = load i8, i8* %21
%45 = call i64 @tolower_(i8 signext %44)
%46 = icmp sgt i64 %43, %45
br i1 %46, label %47, label %49
47: ; preds = %42
%48 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* %3)
br label %59
49: ; preds = %42
%50 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %4)
br label %59
51: ; preds = %24, %19
%52 = load i8, i8* %20
%53 = load i8, i8* %21
%54 = icmp sgt i8 %52, %53
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* %3)
br label %59
57: ; preds = %51
%58 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %4)
br label %59
59: ; preds = %55, %57, %40, %38, %49, %47
%60 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
%61 = icmp sgt i64 %60, 0
br i1 %61, label %17, label %62
62: ; preds = %59, %0
ret i32 0
}