Harryxun/stf_run huggingface dataset:
S = input()
S[3] = '8'
print(S)

### FIXED CODE ###

S = input()
print(S.replace('7', '8', 1))
= list(input())
if '7' in n:
  print('YES')
else:
  print('NO')


### FIXED CODE ###

n = list(input())
if '7' in n:
  print('Yes')
else:
  print('No')
cnt=0
S=str(input())
mc=[0]*2019
L=len(S)

tg=0
digit=1
for s in S[::-1]:
    tg+=int(s)*digit
    mt=tg%2019
    if mt==0:cnt+=1
    cnt+=mc[mt]
    mc[mt]+=1
    digit*=10
    
print(cnt)


### FIXED CODE ###

S,W=map(int,input().split())

if W>=S:
    print('unsafe')
else:
    print('safe')
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

x = max(A)
hurui = [x]*(x+1)
for i in range(2, x+1):
    for j in range(i, x+1, i):
        hurui[j] = min(i, hurui[j])

cnt = Counter()
for i in range(N):
    num = A[i]
    while num > 1:
        x = hurui[num]
        while num%x == 0:
            num //= x
        cnt[x] += 1

a = cnt.most_common(1)[0][1]
if a == 1:
    print("pairwise coprime")
elif a < N:
    print("setwise coprime")
else:
    print("not coprime")


### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split()))

x = max(A)
hurui = [x]*(x+1)
for i in range(2, x+1):
    for j in range(i, x+1, i):
        hurui[j] = min(i, hurui[j])

cnt = Counter([1])
for i in range(N):
    num = A[i]
    while num > 1:
        x = hurui[num]
        while num%x == 0:
            num //= x
        cnt[x] += 1

a = cnt.most_common(1)[0][1]
if a == 1:
    print("pairwise coprime")
elif a < N:
    print("setwise coprime")
else:
    print("not coprime")
n = int(input())
a = list(range(n))
for i in range(n):
    a[i] = list(map(int, input().split()))
tmpx = 0
tmpy = 0
for s in range(n):
    tmpx = a[s][1] - tmpx
    tmpy = a[s][2] - tmpy
    if((dx+dy)>a[s][0]):
        print("NO")
        break
    if(((dx+dy)%2) == (a[s][0]%2)):
        print("YES")
        break
    else:
        print("NO")
        break

### FIXED CODE ###

n = int(input())
a = list(range(n))
for i in range(n):
    a[i] = list(map(int, input().split()))
dx = 0
dy = 0
c = 0
k = 0
for s in range(n):
    dx = a[s][1] - dx
    dy = a[s][2] - dy
    if((dx+dy)>a[s][0]):
        print("No")
        break
    if(((abs(dx)+abs(dy))%2) == ((a[s][0]-k)%2)):
        c += 1
        k += a[s][0]
    else:
        print("No")
        break
if(c == n):
    print("Yes")
import sys

v = []
for line in sys.stdin:
    v = [i for i in line.split()]

m = 0
for a, b in v[1:]:
  a = float(a)
  if b == "JPY":
    m += a
  else:
    m += 380000.0 * a
print(m)

### FIXED CODE ###

import sys
 
v = []
for line in sys.stdin:
    v.append([i for i in line.split()])
 
m = 0
for a, b in v[1:]:
  a = float(a)
  if b == "JPY":
    m += a
  else:
    m += 380000.0 * a
print(m)
N = int(input())
ans = 0
for i in range(1,1250000):
    if(((N-i)/i).is_integer() and N//((N-i)/i) == N%((N-i)/i)):
        # print((N-i)//i,i)
        ans += ((N-i)//i)
        # if(i == 800000):
        #     print(ans)
    # print(i)
print(ans)

### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1,min(N,1250000)):
    if(((N-i)/i).is_integer() and N//((N-i)/i) == N%((N-i)/i)):
        # print((N-i)//i,i)
        ans += ((N-i)//i)
        # if(i == 800000):
        #     print(ans)
    # print(i)
print(ans)
n,k,x,y=map(int,input().split())



### FIXED CODE ###

n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
    sum=n*x
else:
    sum=k*x+(n-k)*y
print(sum)
import math
 
S = int(input())
 
first_half = math.floor(S / 100)
second_half = S - first_half * 100
 
if 1 <= second_half <= 12 and 1 <= first_half <= 12 :
  print("AMBIGUOUS")
elif 1 <= second_half <= 12 :
   		print("YYMM")
elif 1 <= first_half <= 12 :
    	print("MMYY")
else: 
        print("NA")

### FIXED CODE ###

N,K = map(int,input().split())
S = input()

letters = list(S)
letters[K-1] = letters[K-1].lower()

new_S = ""

for letter in letters:
  new_S += letter
  
print(new_S)
HN=input()
HN_list=HN.split()
H=int(HN_list[0])
N=int(HN_list[1])
A=input()
A_list=A.split()
aaa=map(int, A_list)
A_sum=sum(aaa)
if A_sum>H:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import math
str = input()
str_list=str.split()
H=int(str_list[0])
A=int(str_list[1])
Q=math.ceil(H/A)
print(Q)
i = 0

while i == 0:
    x = raw_input()
    a, op, b = x.split()
    a = int(a)
    b = int(b)
    
    if op == "+":
        print a+b
    elif op == "-":
        print a-b
    elif op == "*":
        print a*b
    elif op == "/":
        print a/b
    elif op == "?":
        i == 1

### FIXED CODE ###

i = 1

while i == 1:
    x = raw_input()
    a, op, b = x.split(" ")
    a = int(a)
    b = int(b)
    
    if op == "?":
        i = 0
    elif op == "+":
        print ("%d" %(a+b))
    elif op == "-":
        print ("%d" %(a-b))
    elif op == "*":
        print ("%d" %(a*b))
    else:
        print("%d" %(a/b))
n = int(input())
a = input().split()
alist = set()
adic = {}
for i in a:
    if int(i) in alist:
        adic[int(i)] = adic[int(i)] + 1
    else:
        alist.add(int(i))
        adic[int(i)] = 1

q = int(input())
ans = []
#tt = []

for i in range(q):
    s = input().split()
    b = int(s[0])
    c = int(s[1])
    if b in alist:
        if not(c in alist):
            adic[c] = 0
            alist.add(c)
        adic[c] = adic[c] + adic[b]
        adic[b] = 0
        su = 0
        for j in adic:
            su += j * adic[j]
    #ans.append(sum(adic.values()))
    ans.append(su)
    #tt.append(adic)
    #print(adic)

print(ans)
#print(tt)

### FIXED CODE ###

n = int(input())
a = input().split()
alist = set()
adic = {}
su = 0

for i in a:
    su += int(i)
    if int(i) in alist:
        adic[int(i)] = adic[int(i)] + 1
    else:
        alist.add(int(i))
        adic[int(i)] = 1

q = int(input())
ans = []

for i in range(q):
    s = input().split()
    b = int(s[0])
    c = int(s[1])
    if b in alist:
        if not(c in alist):
            adic[c] = 0
            alist.add(c)
        adic[c] = adic[c] + adic[b]
        su = su + (c * adic[b]) - (b * adic[b])
        adic[b] = 0

    ans.append(su)
for i in range(len(ans)):
    print(ans[i])
N = int(input())
x, y, h = [[0]*N, [0]*N, [0]*N]
for n in range(N):
  x[n], y[n], h[n] = map(int, input().split())


def f():
  for xx in range(101):
    for yy in range(101):
      height = abs(xx-x[0])+abs(yy-y[0])+h[0]
      flag = 1
      for n in range(N):
        if max(height-abs(xx-x[n])-abs(yy-y[n]), 0) is not h[n]:
          flag = 0
      if flag == 1:
        return [xx, yy, height]
print(*f())

### FIXED CODE ###

N = int(input())
x, y, h = [[0]*N, [0]*N, [0]*N]
for n in range(N):
  x[n], y[n], h[n] = map(int, input().split())
  if h[n] > 0:
    hi = n

def g(xx, yy, height):
  for n in range(N):
    if max(height-abs(xx-x[n])-abs(yy-y[n]), 0) != h[n]:
      return False
  return True

def f():
  for xx in range(101):
    for yy in range(101):
      height = abs(xx-x[hi])+abs(yy-y[hi])+h[hi]
      if g(xx, yy, height) is True:
        return [xx, yy, height]
print(*f())
s = list(input())
t = list(input())
new_s = s.sort()
new_t = t.sort(reverse = True)
js = ''.join(new_s)
jt = ''.join(new_t)
if js > jt:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = list(input())
t = list(input())
s.sort()
t.sort(reverse = True)
js = ''.join(s)
jt = ''.join(t)
if js < jt:
  print('Yes')
else:
  print('No')
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
  elif(ceil < 1):
    ceil = 1
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
  elif(ceil < 1):
    ceil = 1
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)


### FIXED CODE ###

import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)
import math

n, m = map(int, input().split())
a = list(map(int, input().split()))
a.append(0)
a.sort(reverse=True)


def waru(i, tempb):
    if a[i] >= 1:
        a[i - 1] = a[i]
        a[i] = tempb

        if a[i] < a[i + 1]:
            waru(i + 1, tempb)


while m > 0:
    a[0] = a[0] // 2
    if a[0] < a[1]:
        waru(1, a[0])
    if a[0] < 1:
        break
    m -= 1

if a[0] < 1:
    print(0)
else:
    print(sum(a))



### FIXED CODE ###

import heapq

n,m  = map(int,input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)

for _ in range(m):
    tmax = heapq.heappop(a)
    tmax = -(-tmax //2)
    heapq.heappush(a,tmax)

print(-1*sum(a))
n = int(input())
a = [int(i) for i in input().spliit()]
ans = 0

while True:
  if a%2 == 1:
    break
  a = a//2 
  ans += 1
print(ans)

### FIXED CODE ###

s = input()
s1 = int(s[0])
s2 = int(s[1])
s3 = int(s[2])

print(s1 + s2+s3)
s  = int(input().split())
s.sort()
if s[0] == 5 and s[1] == 5 and s[2] == 7:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

a = list(map(int, input().split()))
a.sort()
ans = [5, 5, 7]
if ans == a:
    print('YES')
else:
    print('NO')
s=input()
return s[2]==s[3] and s[4]==s[5]

### FIXED CODE ###

S = input()
print("Yes" if S[2]==S[3]and S[4]==S[5] else "No")
n=int(input())
stones=list(map(int, input.split()))
infini=(10**4)*(10**5)
dp = [infini for _ in range(n)]
dp[0]=0
dp[1]=stones[1]
for pos in range(2, n):
   dp[pos] = min(dp[pos], abs(stones[pos] - min(dp[pos-1], dp[pos-2])))
print(dp[-1])

### FIXED CODE ###


n=int(input())
stones=list(map(int, input().split()))
infini=(10**4)*(10**5)
dp = [infini for _ in range(n)]
dp[0]=0

for pos in range(0, n-1):
   dp[pos+1] = min(dp[pos+1], dp[pos] + abs(stones[pos] - stones[pos+1]))
   if pos <= n-3:
      dp[pos+2] = min(dp[pos+2], dp[pos] + abs(stones[pos] - stones[pos+2]))
print(dp[-1])
word = input().split()

if word == "a", "e", "i", "o", "u" :
    print("vowel")
else:
    print("consonant")

### FIXED CODE ###

word = input()

if word=="a" or word=="e" or word=="i" or word=="o" or word=="u" :
    print("vowel")
else:
    print("consonant")
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
acc = sum(B)
j = M - 1
if acc + sum(A) <= K:
    print(M + N)
    exit()
ans = 0
for i in range(N):
    acc += A[i]
    if acc <= K:
        ans = max(ans, i + j + 2)
        continue
    else:
        while acc > K:
            acc -= B[j]
            j -= 1
            if (j == -1) & (acc > K):
                print(ans)
                exit()
        ans = max(ans, i + j + 2)
print(ans)


### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if K >= sum(A) + sum(B):
    print(M + N)
    exit()
acc = 0
ans = 0
for j, b in enumerate(B):
    acc += b
    if K >= acc:
        ans = j + 1
for i in range(N):
    acc += A[i]
    if K >= acc:
        ans = max(ans, i + j + 2)
        continue
    else:
        while (K < acc) & (j > -1):
            acc -= B[j]
            j -= 1
        if K >= acc:
            ans = max(ans, i + j + 2)
print(ans)
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())

lst=sorted(set(A))

target = {}
for i in range(len(lst)):
    target[lst[i]] = i
    
for a in A:
    print(target[a])

### FIXED CODE ###

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

ans = 0
while(max(H)>=0):
    ans +=1
    for i in range(N):
        H[i] -= 1
        if (H[i] >= 0):
            if (i>=1):
                if (H[i-1] < 0 and max(H[:i])>=0):
                    ans += 1

print(ans-1)
import numpy as np

n = int(input())
v = np.array(list(map(int,input().split())))
v_sort = np.sort(v)
temp = 0

for index in range(n-1):
  temp = (v_sort[0]+v_sort[1])/2
  v_sort = np.delete(v_sort,0)
  v_sort = np.delete(v_sort,0)
  v_sort = np.append(v_sort,temp)
  v_sort = np.sort(v_sort)

print(v_sort[0])

### FIXED CODE ###

a = int(input())
s = input()

if a >= 3200:
  print(s)
else:
  print("red")
n = int(input())
s = input()
anss = []
for i in re.finditer(r'#\.|\.#', s):
  l = s[:i.start()+1]
  r = s[i.end()-1:]
  anss.append(l.count('#')+r.count('.'))
print(min(anss))

### FIXED CODE ###

n = int(input())
s = '.'+input()
lb, rw = 0, s.count('.')-1
ans = lb+rw
for i in range(1,n+1):
  if s[i] == '#':
    lb += 1
  elif s[i] == '.':
    rw -= 1
  if lb+rw < ans:
    ans = lb+rw
print(ans)
import heapq
N=int(input())
A=list(map(int, input().split()))

class MaxHeap:
    def __init__(self, li):
        self.hp = []
        for e in li:
            heappush(self.hp, -e)

    def push(self, x):
        heappush(self.hp, -x)

    def pop(self):
        ret = heappop(self.hp)
        ret *= -1
        return ret

    def seak(self):
        return -self.hp[0]

    def sum(self):
        return -sum(self.hp)

A1=A[:N]
A2=A[N:2*N]
A3=A[2*N:]

heapq.heapify(A1)
A1_sum=sum(A1)
A1_li=[A1_sum]
for a in A2:
  p=heapq.heappushpop(A1,a)
  A1_sum+=a-p
  A1_li.append(A1_sum)
  
A3=MaxHeap(A3)
A3_sum=sum(A3)
A3_li=[A3_sum]
for a in A3[::-1]:
  A3.push(a)
  A3_sum+=a
  p=A3.pop()
  A3_sum-=p
  A3_li.append(A3_sum)
  
A3_li=A3_li[::-1]  
ans=False
for a1, a3 in zip(A1_li, A3_li):
  if not ans:
    ans=a1-a3
  else:
    ans=max(ans, a1-a3)
print(ans)

### FIXED CODE ###

from heapq import heapify, heappop, heappush
N=int(input())
A=list(map(int, input().split()))

class MaxHeap:
    def __init__(self, li):
        self.hp = []
        for e in li:
            heappush(self.hp, -e)

    def push(self, x):
        heappush(self.hp, -x)

    def pop(self):
        ret = heappop(self.hp)
        ret *= -1
        return ret

    def seak(self):
        return -self.hp[0]

    def sum(self):
        return -sum(self.hp)

A1=A[:N]
A2=A[N:2*N]
A3=A[2*N:]

heapify(A1)
A1_sum=sum(A1)
A1_li=[A1_sum]
for a in A2:
  heappush(A1, a)
  p=heappop(A1)
  A1_sum+=a-p
  A1_li.append(A1_sum)
  
A3_sum=sum(A3)
A3=MaxHeap(A3)

A3_li=[A3_sum]
for a in A2[::-1]:
  A3.push(a)
  A3_sum+=a
  p=A3.pop()
  A3_sum-=p
  A3_li.append(A3_sum)
  
A3_li=A3_li[::-1]  
ans=False
for a1, a3 in zip(A1_li, A3_li):
  if not ans:
    ans=a1-a3
  else:
    ans=max(ans, a1-a3)
print(ans)
n=int(input())
h=int(input())
w=int(input())

print((n-h+1)*(n-w+1))

### FIXED CODE ###

n=int(input())
a,b = list(map(int, input().split()))
p = list(map(int, input().split()))

q = list([0,0,0])
for i in p:
    if i <= a:
        q[0] += 1
    elif i > b:
        q[2] += 1
    else:
        q[1] +=1

print(min(q))
m, k = map(int, input(.split()))
array = list(map(int, input().split()))

array.sort()
print(sum(array[:k]))


### FIXED CODE ###

m, k = map(int, input().split())
array = list(map(int, input().split()))

array.sort()
print(sum(array[:k]))
def main():
    n, m = map(int, input().split())
    p = 2**n
    inf = 10**7
    dp = [inf]*p
    dp[0] = 0
    for _ in range(m):
        a, _ = map(int, input().split())
        c = sum([1<<(int(i-1)) for i in input().split()])
        for s in range(p):
                t = s|c
                new = dp[s] + a
                if dp[t] > new:
                    dp[t] = new
    ans = dp[-1]
    if ans == inf:
        ans = -1
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

n, m = map(int, input().split())
ac = []
for _ in range(m):
    a, _ = map(int, input().split())
    c = sum([2**(int(i)-1) for i in input().split()])
    ac.append([a, c])
dp = [float('inf')] * 2**n
dp[0] = 0
for s in range(2**n):
    for a, c in ac:
        t = s|c
        if dp[t] > dp[s] + a:
            dp[t] = dp[s] + a
ans = dp[-1]
if ans == float('inf'):
    ans = -1
print(ans)
n,w = map(int,input().split())
m = 1001
for i in range(n):
    a,b = map(int,input().split())
    if b <= w and a < m:
        m = a
if m == 1001:
    print("TLE")
else:
    print(m)
    


### FIXED CODE ###

a=int(input())

if(a==1):
    print('Hello World')

elif(a==2):
    A=int(input())
    B=int(input())
    print(A+B)
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

d = onem()

c = l()

s = []
for i in range(d):
	s.append(l())
day = [0 for i in range(26)]

c = [[c[i],i] for i in range(26)]
c.sort(reverse = True)

for i in range(d):
	print((random.randrange(1,27) + random.randrange(1,27))//2)

### FIXED CODE ###

for i in range(365):
  print(i%26 + 1)
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n=<k:
  ans=n*x
else:
  ans=k*x+y*(n-k)
print(ans)

### FIXED CODE ###

n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
  ans=n*x
else:
  ans=k*x+y*(n-k)
print(ans)
# UnionFind

# 配列で、子のID番目:(親のID), 親のID番目:(その塊の-サイズ)
# Union Findを使う
class UnionFind:
    def __init__(self, size):
        self.parent_indexes = [-1] * size
        
    def find_parent(self, n):
#         print(self.parent_indexes[n])
        if self.parent_indexes[n] < 0:
            return n
#         print('hewe')
        # 探しているnodeが指し示しているのが現在の親ではない場合、
        # 現在の親に書き換え(memo化)た上で返す
        self.parent_indexes[n] = self.find_parent(self.parent_indexes[n])
        return self.parent_indexes[n] 
    
    def union(self, n1, n2):
        if self.same_group(n1, n2):
            return False
        
        # サイズの大きい方の親が親であり続ける
        if self.size(n1) >= self.size(n2):
            tmp = self.size(n2)
            self.parent_indexes[self.find_parent(n2)] = self.find_parent(n1)
            self.parent_indexes[self.find_parent(n1)] -= tmp
            return True
        
        tmp = self.size(n1)
        self.parent_indexes[self.find_parent(n1)] = self.find_parent(n2)
        self.parent_indexes[self.find_parent(n2)] -= tmp
        return True
        
    
    def size(self, n):
        return -self.parent_indexes[self.find_parent(n)]
    
    def same_group(self, n1, n2):
        return self.find_parent(n1) == self.find_parent(n2)


n, m = map(lambda x: int(x), input().split())
uf = UnionFind(n)

for _ in range(m):
    a, b = map(lambda x: int(x), input().split())
    uf.union(a-1, b-1)
    
print(-min(uf.parent_indexes))

# from collections import defaultdict
from collections import deque
n, m = map(lambda x: int(x), input().split())

uf = UnionFind(n)

for _ in range(m):
    a, b = map(lambda x: int(x), input().split())
    uf.union(a-1, b-1)
    
print(-min(uf.parent_indexes))

### FIXED CODE ###

# UnionFind

# 配列で、子のID番目:(親のID), 親のID番目:(その塊の-サイズ)
# Union Findを使う
class UnionFind:
    def __init__(self, size):
        self.parent_indexes = [-1] * size
        
    def find_parent(self, n):
#         print(self.parent_indexes[n])
        if self.parent_indexes[n] < 0:
            return n
#         print('hewe')
        # 探しているnodeが指し示しているのが現在の親ではない場合、
        # 現在の親に書き換え(memo化)た上で返す
        self.parent_indexes[n] = self.find_parent(self.parent_indexes[n])
        return self.parent_indexes[n] 
    
    def union(self, n1, n2):
        if self.same_group(n1, n2):
            return False
        
        # サイズの大きい方の親が親であり続ける
        if self.size(n1) >= self.size(n2):
            tmp = self.size(n2)
            self.parent_indexes[self.find_parent(n2)] = self.find_parent(n1)
            self.parent_indexes[self.find_parent(n1)] -= tmp
            return True
        
        tmp = self.size(n1)
        self.parent_indexes[self.find_parent(n1)] = self.find_parent(n2)
        self.parent_indexes[self.find_parent(n2)] -= tmp
        return True
        
    
    def size(self, n):
        return -self.parent_indexes[self.find_parent(n)]
    
    def same_group(self, n1, n2):
        return self.find_parent(n1) == self.find_parent(n2)



n, m = map(lambda x: int(x), input().split())
uf = UnionFind(n)

for _ in range(m):
    a, b = map(lambda x: int(x), input().split())
    uf.union(a-1, b-1)
    
print(-min(uf.parent_indexes))
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

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

mat_s=[[float('inf')]*N for _ in range(N)]
mat_t=[[float('inf')]*N for _ in range(N)]
for _ in range(M):
    a,b,c,d = map(int,input().split())
    mat_s[a-1][b-1]=c
    mat_s[b-1][a-1]=c
    mat_t[a-1][b-1]=d
    mat_t[b-1][a-1]=d

D_S= dijkstra(csgraph=csr_matrix(mat_s),directed=False,indices=S-1)
D_T= dijkstra(csgraph=csr_matrix(mat_s),directed=False,indices=T-1)


ans=[None]*N

for i in range(N):
    ans[i]= D_S[i]+D_T[i]

tmp=float("inf")

ans_list=[]
for i in reversed(range(N)):
    tmp = min(tmp,ans[i])
    ans_list.append(int(10**15-tmp))
print("\n".join(map(str,reversed(ans_list))))


### FIXED CODE ###

import heapq
N,M,S,T = map(int,input().split())

adj=[[] for _ in range(N)]

for _ in range(M):
    a,b,c,d = map(int,input().split())
    adj[a-1].append((b-1,c,d))
    adj[b-1].append((a-1,c,d))


D_S=[float("inf")]*N
D_T=[float("inf")]*N

D_S[S-1]=0
D_T[T-1]=0

Q=[]
heapq.heappush(Q,S-1)


while Q:
    v = heapq.heappop(Q)
    dist_to_node,node=v//N,v%N
    for nex in adj[node]:
        (next_node,yen,_) = nex
        if dist_to_node+yen<D_S[next_node]:
            D_S[next_node] = dist_to_node+yen
            heapq.heappush(Q,D_S[next_node]*N+next_node)

Q=[]
heapq.heappush(Q,T-1)

while Q:
    v = heapq.heappop(Q)
    dist_to_node,node=v//N,v%N
    if D_T[node]< dist_to_node:
        continue
    for nex in adj[node]:
        (next_node,_,yen) = nex
        if dist_to_node+yen<D_T[next_node]:
            D_T[next_node] = dist_to_node+yen
            heapq.heappush(Q,D_T[next_node]*N+next_node)


tmp_min=float("inf")
ans=[]
for i in reversed(range(N)):
    tmp_min = min(tmp_min,D_S[i]+D_T[i])
    ans.append(tmp_min)


for a in reversed(ans):
    print(10**15-a)