#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 */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, int *);
int main() {
  int m, n, x, y;
  scanf("%d%d%d%d", &m, &n, &x, &y);
  if (x - 1 > 0)
    printf("%d %d\n", x - 1, y);
  if (x + 1 <= m)
    printf("%d %d\n", x + 1, y);
  if (y - 1 > 0)
    printf("%d %d\n", x, y - 1);
  if (y + 1 <= n)
    printf("%d %d\n", x, y + 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cmp    $0x0,%eax
jle    116f <main+0x4f>
mov    -0x10(%rbp),%esi
sub    $0x1,%esi
mov    -0x14(%rbp),%edx
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jg     1193 <main+0x73>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
mov    -0x14(%rbp),%edx
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cmp    $0x0,%eax
jle    11b7 <main+0x97>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
jg     11db <main+0xbb>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x2,%esi
jl     1164 <main+0x44>
add    $0xffffffff,%esi
mov    0x8(%rsp),%edx
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
cmp    0x14(%rsp),%esi
jge    117d <main+0x5d>
add    $0x1,%esi
mov    0x8(%rsp),%edx
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%edx
cmp    $0x2,%edx
jl     119d <main+0x7d>
add    $0xffffffff,%edx
mov    0xc(%rsp),%esi
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%edx
cmp    0x10(%rsp),%edx
jge    11b6 <main+0x96>
add    $0x1,%edx
mov    0xc(%rsp),%esi
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d%d%d%d\00"
@.str.1 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%7 = load i32, i32* %4
%8 = sub nsw i32 %7, 1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %0
%11 = load i32, i32* %4
%12 = sub nsw i32 %11, 1
%13 = load i32, i32* %5
%14 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13)
br label %15
15: ; preds = %10, %0
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
%18 = load i32, i32* %2
%19 = icmp sle i32 %17, %18
br i1 %19, label %20, label %25
20: ; preds = %15
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
%23 = load i32, i32* %5
%24 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %23)
br label %25
25: ; preds = %20, %15
%26 = load i32, i32* %5
%27 = sub nsw i32 %26, 1
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = sub nsw i32 %31, 1
%33 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %30, i32 %32)
br label %34
34: ; preds = %29, %25
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
%37 = load i32, i32* %3
%38 = icmp sle i32 %36, %37
br i1 %38, label %39, label %44
39: ; preds = %34
%40 = load i32, i32* %4
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
%43 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %40, i32 %42)
br label %44
44: ; preds = %39, %34
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d%d%d%d\00"
@.str.1 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %0
%13 = add nsw i32 %10, -1
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %14)
%16 = load i32, i32* %3
br label %17
17: ; preds = %12, %0
%18 = phi i32 [ %16, %12 ], [ %10, %0 ]
%19 = load i32, i32* %1
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = add nsw i32 %18, 1
%23 = load i32, i32* %4
%24 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %23)
br label %25
25: ; preds = %21, %17
%26 = load i32, i32* %4
%27 = icmp sgt i32 %26, 1
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = add nsw i32 %26, -1
%30 = load i32, i32* %3
%31 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %30, i32 %29)
%32 = load i32, i32* %4
br label %33
33: ; preds = %28, %25
%34 = phi i32 [ %32, %28 ], [ %26, %25 ]
%35 = load i32, i32* %2
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %41
37: ; preds = %33
%38 = add nsw i32 %34, 1
%39 = load i32, i32* %3
%40 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %39, i32 %38)
br label %41
41: ; preds = %37, %33
ret i32 0
}