Harryxun/stf_run huggingface dataset:
k = int(input())
num = 0
for _ in range(k):
  num += 1
  digit = [int(digit) for digit in str(num)]
  len_digit = len(digit)
  for i in range(1, len_digit):
    if digit[-i] > min(digit[-i-1] + 1, 9):
      digit[-i-1] += 1
      digit[-i] = -1
    elif digit[-i] < digit[-i-1] - 1:
      digit[-i] = -1
  for i in range(1, len_digit):
    if digit[i] == -1:
      for j in range(i, len_digit):
        digit[j] = max(digit[j-1] - 1, 0)
      break
  num = d[0]
  for d in digit[1:]:
    num = num * 10 + d
print(num)

### FIXED CODE ###

k = int(input())
num = 0
for _ in range(k):
  num += 1
  digit = [int(digit) for digit in str(num)]
  len_digit = len(digit)
  flag = False
  for i in range(1, len_digit):
    # current_digit = digit[-i]
    # upper_digit = digit[-i-1]
    if digit[-i] == 10:
      digit[-i-1] += 1
      digit[-i] = -1
    elif digit[-i] > digit[-i-1] + 1:
      digit[-i-1] += 1
      digit[-i] = -1
    elif digit[-i] < digit[-i-1] - 1:
      digit[-i] = -1
  if digit[0] == 10:
    num = 10 ** len_digit
  else:
    for i in range(1, len_digit):
      if digit[i] == -1:
        for j in range(i, len_digit):
          digit[j] = max(digit[j-1] - 1, 0)
        break
    num = 0
    for d in digit:
      num = num * 10 + d
print(num)
s=input()
i=0
j=len(s)-1
ans=0
while i<j:
    while s[i]==s[j]=="x":
        i+=1
        j-=1
    if i>j:break    
    while s[i]=="x":
        i+=1
        ans+=1
        if i>=len(s):break
    if i>j:break
    while s[j]=="x":
        j-=1
        ans+=1
        if j<=-1:break
    if s[i]!=s[j]:
        ans=-1
        break
    if i>j:break
    i+=1
    j-=1
    if i>j:break
print(ans)

### FIXED CODE ###

s=input()
i=0
j=len(s)-1
ans=0
while i<j:
    while s[i]==s[j]=="x":
        i+=1
        j-=1
        if i>j:break
    if i>j:break    
    while s[i]=="x":
        i+=1
        ans+=1
        if i>j:break
    if i>j:break
    while s[j]=="x":
        j-=1
        ans+=1
        if i>j:break
    if i>j:break
    if s[i]!=s[j]:
        ans=-1
        break
    i+=1
    j-=1
    if i>j:break
print(ans)
data =[[[0 for r in range(10)] for f in range(3)] for b in range(4)]
ans = ""
n = input()
for i in range(0, n):
    b, f, r, v = map(int, raw_input().split(" "))
    data[b-1][f-1][r-1] += v
    
for b in range(4):
    for f in range(3):
         for r in range(10):
                ans += " " + str(a[b][f][r])
         if(b != 3 or f != 2 or r !=9):
            ans += "\n"
    if(b !=3):
        ans += "#"*20 + "\n"
        
print ans

### FIXED CODE ###

data =[[[0 for r in range(10)] for f in range(3)] for b in range(4)]
result = ""
n = input()
for i in range(0, n):
    b, f, r, v = map(int, raw_input().split(" "))
    data[b-1][f-1][r-1] += v
    
for b in range(4):
    for f in range(3):
         for r in range(10):
                result += " " + str(data[b][f][r])
         if(b != 3 or f != 2 or r !=9):
            result += "\n"
    if(b != 3):
        result += "#"*20 + "\n"
        
print result
# Thanks for http://nihaoshijie.hatenadiary.jp/entry/2018/02/03/115759

N, M = map(int, input().split())


def factorize(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def divisorize(fct):
    b, e = fct.pop()
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a


fct = factorize(M)
L   = []
for div in divisorize(fct):
    L.append(num(div))

L.sort()
L.reverse()

for l in L:
    if l * N <= M and M % l == 0:
        print(l)
        break


### FIXED CODE ###

# Thanks for http://nihaoshijie.hatenadiary.jp/entry/2018/02/03/115759

N, M = map(int, input().split())


def factorize(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def divisorize(fct):
    b, e = fct.pop()
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a


try:
    fct = factorize(M)
    L   = []
    for div in divisorize(fct):
        L.append(num(div))
except:
    L = [1, M]

L.sort()
L.reverse()

for l in L:
    if l * N <= M and M % l == 0:
        print(l)
        break
A= int(input())
B = int(input())
C = int(input())
D= int(input())
L=A+B
R=C+D
if L>R:
  print('Left')
elif L=R:
  print('Balanced')
else :
  print('Right')

### FIXED CODE ###

a , b, c ,d = map(int,input().split(' '))
L=a+b
R=c + d
if L> R:
    print('Left')
elif L<R:
    print('Right')
else:
    print('Balanced ')
# -*- coding: utf-8 -*-
import math
N, K = map(int, input().split())
A = input().split()
AK = [[0 for j in range(N)] for i in range(2)]
for l in range(N):
  AK[0][l] = int(AK[0][l]) + int(A[l])
p = min(K,40)
for m in range(1,p+1,1):
  for o in range(N):
    for x in range(N):
      if((o-AK[0][o]+0.5) < (x+1)) and ((x+1) < (o+AK[0][o]+1.5)):
        AK[1][x] = AK[1][x] +1
  AK[0] = AK[1]
  AK[1] = [0] * N
print(*AK[0])

### FIXED CODE ###

# -*- coding: utf-8 -*-
s = input()
# 出力
print(s[0:3])
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len[1 for i in range(a+1) for m in range(b+1) if 0<<x-500*i+100*m<<s ])

### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len([1 for i in range(a+1) for m in range(b+1) if 0<=x-500*i-100*m<=s]))
#!/usr/bin/env python3

a, b = list(map(int, input().split()))
# print(a, b)

a -= 1
b -= 1
wide = 12

ans1 = [["#"]*wide for i in range(wide//2)]

ans2 = [["."]*wide for i in range(wide//2)]

index_x = 0
index_y = 0
while(a > 0):
    ans1[index_y][index_x] = "."
    index_x += 2
    if index_x == wide:
        index_x = 0
        index_y += 2
    a -= 1


index_x = 0
index_y = 1
a = b
while(a > 0):
    ans2[index_y][index_x] = "#"
    index_x += 2
    if index_x == wide:
        index_x = 0
        index_y += 2
    a -= 1

print(100, 100)
for i in ans1+ans2:
    print("".join(i))


### FIXED CODE ###

#!/usr/bin/env python3

a, b = list(map(int, input().split()))
# print(a, b)

a -= 1
b -= 1
wide = 100

ans1 = [["#"]*wide for i in range(wide//2)]

ans2 = [["."]*wide for i in range(wide//2)]

index_x = 0
index_y = 0
while(a > 0):
    ans1[index_y][index_x] = "."
    index_x += 2
    if index_x == wide:
        index_x = 0
        index_y += 2
    a -= 1


index_x = 0
index_y = 1
a = b
while(a > 0):
    ans2[index_y][index_x] = "#"
    index_x += 2
    if index_x == wide:
        index_x = 0
        index_y += 2
    a -= 1

print(100, 100)
for i in ans1+ans2:
    print("".join(i))
def gcd(a, b):
    c = a%b
    while(c != 0):
        a = b
        b = c
        c = a%b
    return b

def answer(s, t):
    a = len(s)
    b = len(t)
    if a < b:
        temp = a
        a = b
        b = temp
    gcdAB = gcd(a, b)
    if gcdAB == 1:
        return a*b
    else:
        stack = 0
        sl = (gcdAB * (a//gcdAB) * (b//gcdAB))
        for i in range(gcdAB):
            if s[stack//gcdAB] != t[stack//(sl//b)]:
                return -1
            stack += a
        return a*gcdAB

sl, tl = map(int, input().split())
s = input()
t = input()
print(answer(s, t))


### FIXED CODE ###

def gcd(a, b):
    c = a%b
    while(c != 0):
        a = b
        b = c
        c = a%b
    return b

def answer(s, t):
    a = len(s)
    b = len(t)
    if s[0] != t[0]:
        return -1
    if a < b:
        temp = a
        a = b
        b = temp
        temp = s
        s = t
        t = temp
    gcdAB = gcd(a, b)
    if gcdAB == 1:
        return a*b
    else:
        stack = 0
        sl = (gcdAB * (a//gcdAB) * (b//gcdAB))
        aJump = sl//a
        bJump = sl//b
        for i in range(b):
            if stack%aJump == 0:
                if s[stack//aJump] != t[i]:
                    return -1
            stack = bJump*(i+1)
        return sl
                

sl, tl = map(int, input().split())
s = input()
t = input()
print(answer(s, t))
import fractions
from functools import reduce
 
def lcm_b(a, b):
        #print("base",a,b)
        return (a * b) // fractions.gcd(a, b)
 
def lcm_o():
        global n
        return reduce(lcm_b, n)
 
def chk(v):
        global n
        for i in range(1,30):
                if v%2 == 1:break
                v = v//2
        t=2**(i-1)
        for j in range(len(n)):
                s=n[j]/t
                if n[j] % t == 0 and s % 2 == 1:
                        n[j] = int(s)
 
                else: return 0
        return t/2
 
def mp(v):
        if v%2==1:v+=1
        return int(v//2)
 
N,M= [int(i) for i in input().split()]
n = [int(i) for i in input().split()]
n=sorted(set(n),reverse = True)
bs = n[0]
 
if len(n) > 1:
        c = chk(n[-1])
        if  c != 0:
                v = lcm_o()*c
                if v > M: print(0) 
 
                else: print(mp(M//v))
        
        else: print(0)
        
elif len(n)==1: print(mp(M//int(bs//2)))

### FIXED CODE ###

import fractions
from functools import reduce
N,M= [int(i) for i in input().split()]
n = [int(i) for i in input().split()]
#print(n)
n=sorted(set(n),reverse = True)
bs = n[0]
#print(n)
#c=len(n)
 
 
def lcm_b(a, b):
        #print("base",a,b)
        return (a * b) // fractions.gcd(a, b)
 
def lcm_o():
        global n
        return reduce(lcm_b, n)
 
def chk(v):
        global n
        for i in range(1,30):
                if v%2 == 1:break
                v = v//2
        t=2**(i-1)
        for j in range(len(n)):
                if n[j] % t == 0 and (n[j] / t) % 2 == 1:
                        n[j] = int(n[j]/t)
                else: return 0
        return i-1
 
if len(n) > 1:
        
        c = chk(n[-1])
        
        if  c != 0:
                v = lcm_o()*(2**(c-1))
                
                if v > M:
                        print(0) 
                else:
                        v = M//v
                        if v%2==1: v+=1
                        print(int(v//2))
        
        else: print(0)
elif len(n)==1:
        v = int(bs*0.5)
        v = M//v
        if v%2==1: v+=1
        print(int(v//2))
x = input()
print(1 - x)

### FIXED CODE ###

x = int(input())
print(1 - x)
N,M = map(int,input().split())
S = input()
N0 = 2**(N-1).bit_length()
INF = 2**31-1

# k番目の要素をxに更新
def update(k, x, data):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = min(data[2*k+1], data[2*k+2])

# [l,r)の最小値
def query(l, r, data):
    L = l + N0; R = r + N0
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = min(s, data[R-1])

        if L & 1:
            s = min(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s



data1 = [INF]*(2*N0)
update(0,0,data1)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(max(0,n-M+1),n+1,data1)+1,data1)

S = S[::-1]
data2 = [INF]*(2*N0)
update(0,0,data2)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(max(0,n-M+1),n+1,data2)+1,data2)

cost1 = [INF]*(N+1)
cost2 = [INF]*(N+1)
for n in range(N+1):
    cost1[n] = query(n,n+1,data1)
    cost2[n] = query(N-n,N-n+1,data2)

ans = []
cost = 0
for n in range(N+1):
    if cost != cost1[n] and cost1[n]+cost2[n]==cost1[N]:
        ans.append(n)
        cost = cost1[n]
ans = [0]+ans
for i in range(len(ans)-2,-1,-1):
    ans[i+1] = ans[i+1]-ans[i]

ans = ' '.join([str(c) for c in ans[1:]])
if cost2[0]==INF:
    ans = '-1'
print(ans)


### FIXED CODE ###

N,M = map(int,input().split())
S = input()
N0 = 2**(N-1).bit_length()
INF = 2**31-1

# k番目の要素をxに更新
def update(k, x, data):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = min(data[2*k+1], data[2*k+2])

# [l,r)の最小値
def query(l, r, data):
    L = l + N0; R = r + N0
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = min(s, data[R-1])

        if L & 1:
            s = min(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s



data1 = [INF]*(3*N0)
update(0,0,data1)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(max(0,n-M+1),n+1,data1)+1,data1)

S = S[::-1]
data2 = [INF]*(3*N0)
update(0,0,data2)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(max(0,n-M+1),n+1,data2)+1,data2)

cost1 = [INF]*(N+1)
cost2 = [INF]*(N+1)
for n in range(N+1):
    cost1[n] = query(n,n+1,data1)
    cost2[n] = query(N-n,N-n+1,data2)

ans = []
cost = 0
for n in range(N+1):
    if cost != cost1[n] and cost1[n]+cost2[n]==cost1[N]:
        ans.append(n)
        cost = cost1[n]
ans = [0]+ans
for i in range(len(ans)-2,-1,-1):
    ans[i+1] = ans[i+1]-ans[i]

ans = ' '.join([str(c) for c in ans[1:]])
if cost2[0]==INF:
    ans = '-1'
print(ans)
n=int(input())
s=[int(input()) for _ in range(n)]
x=sum(s)
if x%10:
  print(x)
else:
  a=[]
  for i in s:
    if i%10:
      a.appned(i)
  if a:
    print(x-min(a))
  else:
    print(0)
  

### FIXED CODE ###

n=int(input())
s=[int(input()) for _ in range(n)]
x=sum(s)
if x%10:
  print(x)
else:
  a=[]
  for i in s:
    if i%10:
      a.append(i)
  if a:
    print(x-min(a))
  else:
    print(0)
N = int(input())
s = input().split()
count = 1
for i in range(N):
  s[i] = int(s[i])
for i in range(1,N+1):
  t = s[:i]
  if max(t) <= s[i]:
    count = count + 1
print(count)


### FIXED CODE ###

N = int(input())
s = input().split()
count = 1
for i in range(N):
  s[i] = int(s[i])
for i in range(1,N):
  t = s[:i]
  if max(t) <= s[i]:
    count = count + 1
print(count)
#!/usr/bin/env python3
import sys
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors

def lef(a, b):
    return a*a*a*a + a*a*a*b + a*a*b*b + a*b*b*b + b*b*b*b

def solve(X: int):
    divs = make_divisors(X)
    for d in divs:
        base = 0
        upper = X // d
        while(lef(base+d,base) < upper):
            base+=1
        if lef(base+d,base) == upper:
            print(base+d,base)
            return

        base = -math.ceil(d//2)
        while(lef(base+d,base) < upper) and (base > d//2-1):
            base -= 1
        if lef(base+d, base) == upper:
            print(base+d, base)
            return

        base = -d
        while(lef(base+d,base) < upper) and (base < -d//2+1):
            base += 1
        if lef(base+d, base) == upper:
            print(base+d, base)
            return

        base = -d
        while(lef(base+d,base) < upper):
            base -= 1
        if lef(base+d, base) == upper:
            print(base+d, base)
            return
    raise
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

def solve(X: int):

    for i in range(-150, 150):
        for j in range(-150, 150):
            if j**5 - i**5 == X:
                print(j, i)
                return
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()
a = True
while a:
    l = map(int, list(input()))
    if l[0] != 0:
        print(sum(l))
    else:
        a = False



### FIXED CODE ###

a = True
while a:
    l = list(map(int, list(input())))
    if l[0] != 0:
        print(sum(l))
    else:
        a = False
n=int(input())
a=list(map(int.input().split())
print(max(a)-min(a))

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    S = input().rstrip()

    words = ['dream','dreamer','erase','eraser']

    res = 'YES'

    pre = S
    now = S

    while True:
        for i in range(4):
            word = words[i]
            N = len(word)
            M = len(now)
            if N <= M:
                # l = now[:N]
                r = now[M-N:]
                # if l == word:
                    # now = now[N:]
                if r == word:
                    now = now[:M-N]
            print(now)
        if now == '':
            break
        elif now == pre:
            res = 'NO'
            break
        else:
            pre = now

    print(res)



main()


### FIXED CODE ###

S = input()

words = ['dream','dreamer','erase','eraser']

damm = True

T = ''

while damm:
    damm = False
    for test in words:
        if S.endswith(test+T):
            T = test + T
            damm = True
            break
    if S == T:
        damm = True
        break

if damm:
    print('YES')
else:
    print('NO')
S,T=map(input().split())
A,B=map(int,input().split())
U=input()

if U==S:
  print(A-1)
  print(B)
else:
  print(A)
  print(B-1)

### FIXED CODE ###

S,T=input().split()
A,B=map(int,input().split())
U=input()
 
if U==S:
  print(A-1)
  print(B)
else:
  print(A)
  print(B-1)
from collections import deque

N = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)

deq = deque([A[0]])
ans = 0

for x in A[1:]:
    print(f"{deq=}, {x=}")
    ans += deq.popleft()
    deq.append(x)
    deq.append(x)

print(ans)


### FIXED CODE ###

import sys
from collections import deque

read = sys.stdin.buffer.read

N, *A = map(int, read().split())
A.sort(reverse=True)

deq = deque([A[0]])
ans = 0

for x in A[1:]:
    ans += deq.popleft()
    deq.append(x)
    deq.append(x)

print(ans)
A = int(input())
B = int(input())
if A > B:
  print("GREAT")
elif A < B:
  print("LESS")
else:
  print("EQUAL")
                

### FIXED CODE ###

s1,s2,s3 = input().split()
print(s1[0].capitalize() + s2[0].capitalize() + s3[0].capitalize())
n,k=map(int,input().split())
seq=list(map(int,input().split()))
v=[False]*n
path=[]
i=seq.index(1)
while True:
        if v[seq[i]-1]==False:
                v[seq[i]-1]=True
                path.append(seq[i])
                i=seq[i]-1
                
        else:
                break
print(path[(k%len(path))])
print(path)
                


### FIXED CODE ###

n,k=map(int,input().split())
seq=list(map(int,input().split()))
v=[False]*n
path=[1]
i=0
v[0]=True
while True:
        if v[seq[i]-1]==False:
                v[seq[i]-1]=True
                path.append(seq[i])
                i=seq[i]-1
                
        else:
                t=seq[i]
                break

ind=path.index(t)
path2=path[ind:]
path1=path[:ind]
x=len(path1)
if k>=x:
        k-=x
        #print(t,ind,path1,path2)
        print(path2[(k%len(path2))])

else:
        print(path1[k])
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()
    SC = [il() for _ in range(M)]
    mi = pow(10, N - 1)-1
    mx = pow(10, N)

    for n in range(mi, mx):
        isSC = True
        for s, c in SC:
            if str(n)[s - 1] != str(c):
                isSC = False

        if isSC:
            print(n)
            exit()

    print(-1)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = list(map(int, sys.stdin.readline().split()))
    lines = [line.rstrip() for line in sys.stdin.readlines()]

    ret = -1
    MIN = 0 if N == 1 else pow(10, N - 1)
    MAX = 10 if N == 1 else pow(10, N)
    for n in range(MIN, MAX):
        flg = True
        for line in lines:
            s, c = map(int, line.split())
            t = str(n)

            if t[s - 1] != str(c):
                flg = False

        if flg:
            ret = n
            break

    print(ret)


if __name__ == '__main__':
    main()
from math import sqrt


def dfs(remains, elapsed, hx, hy):
    global crystals

    if not remains:
        return True

    remains_c = set()
    for i in remains:
        cx, cy, dfd = crystals[i]
        dfh = sqrt((cx - hx) ** 2 + (cy - hy) ** 2)
        new_elapsed = elapsed + dfh
        if dfd <= new_elapsed:
            return False
        remains_c.add((i, cx, cy, new_elapsed))

    for i, cx, cy, new_elapsed in remains_c:
        remains.discard(i)
        if dfs(remains, new_elapsed, cx, cy):
            return True
        remains.add(i)

    return False


while True:
    n, hx, hy, dx, dy = map(int, input().split())
    if n == 0: break

    crystals = [(cx, cy, sqrt((cx - dx) ** 2 + (cy - dy) ** 2)) for cx, cy in
                (map(int, input().split()) for _ in range(n))]

    print('YES' if dfs(set(range(n)), 0, hx, hy) else 'NO')

### FIXED CODE ###

from math import sqrt


def dfs(remains, elapsed, hx, hy, prev):
    global crystals, dc

    if not remains:
        return True

    remains_c = set()
    for i in remains:
        cx, cy, dfd = crystals[i]
        new_elapsed = elapsed + dc[prev][i]
        if dfd <= new_elapsed:
            return False
        remains_c.add((i, cx, cy, new_elapsed))

    for i, cx, cy, new_elapsed in remains_c:
        remains.remove(i)
        if dfs(remains, new_elapsed, cx, cy, i):
            return True
        remains.add(i)

    return False


while True:
    n, hx, hy, dx, dy = map(int, input().split())
    if n == 0: break

    crystals_in = [tuple(map(int, input().split())) for _ in range(n)]
    crystals = [(cx, cy, sqrt((cx - dx) ** 2 + (cy - dy) ** 2)) for cx, cy in crystals_in]
    crystals_in += [(hx, hy)]
    dc = [[sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) for x2, y2 in crystals_in] for x1, y1 in crystals_in]

    print('YES' if dfs(set(range(n)), 0, hx, hy, n) else 'NO')