You have a deck of N cards, each with an integer written on it. Two players, X and Y, take turns drawing cards from the deck and discarding the card in their hand, keeping the last drawn card instead. The game ends when there are no more cards in the deck. The score is the absolute difference of the integers on the cards in the players' hands. X aims to maximize the score, while Y aims to minimize it. The task is to determine the final score of the game. Constraints: N (number of cards) is between 1 and 2000, and the integers on the cards and initial hands are between 1 and 10^9. The input format is N, Z, W, followed by the integers on the cards. The output is the final score.

# Buggy version:
n,z,w=[int(x) for x in input().split()]

a=[int(x) for x in input().split()]

if(n==1):
  print(abs(a[0]-w))
else:
  print(min(abs(a[-1]-w),abs(a[-1]-a[-2])))

# Fixed version:
n,z,w=[int(x) for x in input().split()]
 
a=[int(x) for x in input().split()]
 
if(n==1):
  print(abs(a[0]-w))
else:
  print(max(abs(a[-1]-w),abs(a[-1]-a[-2])))

# Buggy version:
N,Z,W=map(int,input().split())
A=list(map(int, input().split()))
if N==1:
  print(abs(A[-1]-W))
elif N==2:
  print(abs(A[-1]-W),abs(A[0]-A[-1]))
else:
  a=abs(A[-1]-W)
  b=abs(max(A[:N-1])-A[-1])
  print(max(a,b)

# Fixed version:
N,Z,W=map(int,input().split())
A=list(map(int, input().split()))
if N==1:
  print(abs(A[-1]-W))
else:
  a=abs(A[-1]-W)
  b=abs(A[-2]-A[-1])
  print(max(a,b))

# Buggy version:
N, Y, Z = map(int, input().split())
As = list(map(int, input().split()))
dpx, dpy = [0]*(N-1), [0]*(N-1)
#dpx[i] = min(dpy[i+1]...dpy[N-2], abs(As[N-1]-As[i]))
#dpy[i] = max(dpx[i+1]...dpx[N-2], abs(As[N-1]-As[i]))
for i in range(N-2, -1, -1):
    mny, mxx = 10**10, 0
    for j in range(i+1, N-1):
        mny = min(mny, dpy[j])
        mxx = max(mxx, dpx[j])
    dpx[i] = min(mny, abs(As[N-1]-As[i]))
    dpy[i] = min(mxx, abs(As[N-1]-As[i]))
#print(dpx)
print(max(max(dpx),abs(As[N-1]-Z)))


# Fixed version:
N, Y, Z = map(int, input().split())
As = list(map(int, input().split()))
dpx, dpy = [0]*(N-1), [0]*(N-1)
#dpx[i] = min(dpy[i+1]...dpy[N-2], abs(As[N-1]-As[i]))
#dpy[i] = max(dpx[i+1]...dpx[N-2], abs(As[N-1]-As[i]))
for i in range(N-2, -1, -1):
    mny, mxx = 10**10, 0
    for j in range(i+1, N-1):
        mny = min(mny, dpy[j])
        mxx = max(mxx, dpx[j])
    dpx[i] = min(mny, abs(As[N-1]-As[i]))
    dpy[i] = max(mxx, abs(As[N-1]-As[i]))
dpx.append(abs(As[N-1]-Z))
print(max(dpx))

# Buggy version:
N,Z,W = map(int,input().split())
A = list(map(int,input().split()))
if abs(A[-1]-A[-2]) >= abs(A[-1]-W):
  print(abs(A[-1]-A[-2]))
else:
  print(abs(A[-1]-W))


# Fixed version:
N,Z,W = map(int,input().split())
A = list(map(int,input().split()))
if N == 1:
  print(abs(A[0]-W))
  exit()
  
if abs(A[-1]-A[-2]) >= abs(A[-1]-W):
  print(abs(A[-1]-A[-2]))
else:
  print(abs(A[-1]-W))

# Buggy version:
n,z,w=map(int,input().split())
A=[int(x) for x in input().split()]
print(max(abs(A[n-2]-A[n-1]),abs(A[n-1],w))) if n!=1 else print(abs(a[0]-w))

# Fixed version:
n,z,w=map(int,input().split())
A=[int(x) for x in input().split()]
print(max(abs(A[n-2]-A[n-1]),abs(A[n-1]-w))) if n!=1 else print(abs(A[0]-w))

# Buggy version:
ai = lambda: list(map(int,input().split()))
n, z, w = ai()
a = ai()
if n == a:
    print(abs(a[-1]-w))
else:
    print(max(abs(a[-1]-w), abs(a[-1]-a[-2])))


# Fixed version:
ai = lambda: list(map(int,input().split()))
n, z, w = ai()
a = ai()
if n == 1:
    print(abs(a[-1]-w))
else:
    print(max(abs(a[-1]-w), abs(a[-1]-a[-2])))

# Buggy version:
N,Z,W=map(int,input().split())
a=[int(i) for i in input().split()]
if N==1:
  print(W-a[0])
else:
  print(max(abs(W-a[-1]),abs(a[-2]-a[-1])))

# Fixed version:
N,Z,W=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

if N>1:
        print(max(abs(a[-1]-W),abs(a[-2]-a[-1])))
else:
        print(abs(a[0]-W))

# Buggy version:
N, Z, W = map(int,input().split())
p = list(map(int,input().split()))
a = abs(p[1] - p[2])
b = abs(p[2] - W)
print(max(a, b))

# Fixed version:
N, Z, W = map(int,input().split())
p = list(map(int,input().split()))
a = abs(p[N-2] - p[N-1])
b = abs(p[N-1] - W)
print(max(a, b))

# Buggy version:

def main():
    N,Z,W = map(int,input().split())
    a = list(map(int,input().split()))

    print(max(abs(a[N-1]-W,abs(a[N-1]-a[N-2]))))

if __name__ == '__main__':
    main()

# Fixed version:

def main():
    N,Z,W = map(int,input().split())
    a = list(map(int,input().split()))

    print(max(abs(a[N-1]-W),abs(a[N-1]-a[N-2])))

if __name__ == '__main__':
    main()

# Buggy version:
import math
N,Z,W=list(map(int,input().split()))
i=0
a=list(map(int,input().split()))
b=math.fabs(a[N-1]-W)
c=math.fabs(a[N-2]-a[N-1])
print(max(b,c))

# Fixed version:
import math
N,Z,W=list(map(int,input().split()))
a=list(map(int,input().split()))
b=math.fabs(a[N-1]-W)
c=math.fabs(a[N-2]-a[N-1])
print(int(max(b,c)))

# Buggy version:
#!/usr/bin/env python

def main():
    N, Z, W = map(int, input().split(" "))
    a = list(map(int, input().split(" ")))
    
    if N == 1:
        print(abs(a[0] - W))
    else:
        print(max(abs(a[0] - W), abs(a[N - 2] - a[N - 1])))

if __name__ == '__main__':
    main()


# Fixed version:
#!/usr/bin/env python

def main():
    N, Z, W = map(int, input().split(" "))
    a = list(map(int, input().split(" ")))
    
    if N == 1:
        print(abs(a[0] - W))
    else:
        print(max(abs(a[N - 1] - W), abs(a[N - 2] - a[N - 1])))

if __name__ == '__main__':
    main()

# Buggy version:
n, x, y = map(int, input().split())
a = list(map(int, input().split()))

if n == 1:
    print(abs(a[0] - y))
else:
    print(max(abs(a[0] - y), abs(a[-1] - a[-2])))


# Fixed version:
n, x, y = map(int, input().split())
a = list(map(int, input().split()))

if n == 1:
    print(abs(a[-1] - y))
else:
    print(max(abs(a[-1] - y), abs(a[-1] - a[-2])))

# Buggy version:
l=input().split()
n=int(l[0])
w=int(l[2])
l=input().split()
a=[]
for i in range(n):
  a.append(int(l[n-1-i]))
s=[]
m=[]
if n>=3:
  s.append(abs(a[1]-a[0]))
  s.append(max(abs(a[2]-a[0]),abs(a[1]-a[0])))
  m=[s[0],min(s[0],s[1])]
  x=min(abs(a[2]-a[0]),m[0])
  for i in range(2,n-2):
    if(max(abs(a[i]-a[0]),m[i-2])>x):
      x=max(abs(a[i]-a[0]),m[i-2])
    s.append(max(abs(a[i+1]-a[0]),x,abs(a[1]-a[0])))
    m.append(min(s[-1],m[-1]))
  s.reverse()
  if n==3:
    del(s[0])
  res=[abs(w-a[0]),abs(a[-2]-a[-1])]
  a.reverse()
  for i in range(n-2):
    res.append(min(abs(a[-2]-a[-1]),abs(a[i]-a[-1]),min(s[i:])))
  print(max(res))
if n==2:
  print(max(abs(w-a[0]),abs(a[1]-a[0])))
if n==1:
  print(abs(w-a[0]))

# Fixed version:
l=input().split()
n=int(l[0])
w=int(l[2])
l=input().split()
a=[]
for i in range(n):
  a.append(int(l[n-1-i]))
s=[]
m=[]
if n>=3:
  s.append(abs(a[1]-a[0]))
  s.append(max(abs(a[2]-a[0]),abs(a[1]-a[0])))
  m=[s[0],min(s[0],s[1])]
  x=min(abs(a[2]-a[0]),m[0])
  for i in range(2,n-2):
    if(max(abs(a[i]-a[0]),m[i-2])>x):
      x=max(abs(a[i]-a[0]),m[i-2])
    s.append(max(abs(a[i+1]-a[0]),x,abs(a[1]-a[0])))
    m.append(min(s[-1],m[-1]))
  s.reverse()
  if n==3:
    del(s[0])
  res=[abs(w-a[0]),abs(a[1]-a[0])]
  a.reverse()
  for i in range(n-2):
    res.append(min(abs(a[-2]-a[-1]),abs(a[i]-a[-1]),min(s[i:])))
  print(max(res))
if n==2:
  print(max(abs(w-a[0]),abs(a[1]-a[0])))
if n==1:
  print(abs(w-a[0]))
s.append