Harryxun/stf_run huggingface dataset:
a,b=input().split()
print "Yes" if float.is_integer(math.sqrt(int(a+b))) else "No"

### FIXED CODE ###

import math
a, b = input().split()
print("Yes") if float.is_integer(math.sqrt(int(a+b))) else print("No")
A B C
D = B-A
E = C-D
E

### FIXED CODE ###

A, B, C = map(int, input().split())

if A-B>=C:
    print(0)
else:
    print(C-(A-B))
import bisect
import copy
H, W, K = map(int, input().split())
c = [list(input()) for _ in range(H)]

ilst = []
index = 1
for i in range(H):
    for j in range(W):
        if c[i][j] == '#':
            c[i][j] = index
            index += 1
            ilst.append([i, j])

nlst = []
for i in range(K - 1):
    if ilst[i][0] == ilst[i + 1][0]:
        cindex = 0
        if c[ilst[i][0]][0] != '.':
            cindex = ilst[i][1]

        for j in range(cindex, ilst[i + 1][1]):
            c[ilst[i][0]][j] = i + 1
        for j in range(ilst[i + 1][1], W):
            c[ilst[i + 1][0]][j] = i + 2
    else:
        if c[ilst[i][0]][0] == '.':
            for j in range(W):
                c[ilst[i][0]][j] = i + 1
    if c[ilst[i][0]] != '.':
        if nlst == []:
            nlst.append(ilst[i][0])
        elif nlst[-1] != ilst[i][0]:
            nlst.append(ilst[i][0])

for i in range(H):
    if c[i][0] == '.':
        copyi = bisect.bisect_left(nlst, i)
        if copyi < len(nlst):
            c[i] = copy.copy(c[nlst[copyi]])
        else:
            c[i] = copy.copy(c[nlst[len(nlst) - 1]])

for i in range(H):
    for j in range(W):
        if j != W - 1:
            print(c[i][j], end=' ')
        else:
            print(c[i][j])

### FIXED CODE ###

H, W, K = map(int, input().split())
c = [list(input()) for _ in range(H)]

index = 0
for i in range(H):
    cnt = 0
    for j in range(W):
        if c[i][j] == '#':
            index += 1
            cnt = index
            c[i][j] = cnt
        if c[i][j] == '.' and cnt != 0:
            c[i][j] = cnt

for i in range(H):
    for j in reversed(range(W - 1)):
        if c[i][j] == '.':
            c[i][j] = c[i][j + 1]

for i in range(H - 1):
    for j in range(W):
        if c[i][j] != '.' and c[i + 1][j] == '.':
            c[i + 1][j] = c[i][j]

for i in reversed(range(1, H)):
    for j in range(W):
        if c[i][j] != '.' and c[i - 1][j] == '.':
            c[i - 1][j] = c[i][j]


for i in range(H):
    for j in range(W):
        if j != W - 1:
            print(c[i][j], end=' ')
        else:
            print(c[i][j])
import sys
import numpy as np
N, W = map(int, input().split())
def knapsack(n, w):
    # dp[i][j] : i番目の品物で重さj以下の価値の最大値
    dp = np.zeros([N+1, W+1], dtype='int64')
    # forは関数の中で回す。
    for i in range(N):
        w, v = map(int, input().split())
        # i+1番目でwより小さい場合は、i番目と変更なし
        dp[i+1][:w] = dp[i][:w]
        dp[i+1][w:] = np.maximum(dp[i][w:], dp[i][:w] + v)
    return dp[-1][-1]

print(knapsack(N, W))

### FIXED CODE ###

import sys
import numpy as np
N, W = map(int, input().split())
def knapsack(n, w):
    # dp[i][j] : i番目の品物で重さj以下の価値の最大値
    dp = np.zeros([N+1, W+1], dtype='int64')
    # forは関数の中で回す。
    for i in range(N):
        w, v = map(int, input().split())
        # i+1番目でwより小さい場合は、i番目と変更なし
        dp[i+1][:w] = dp[i][:w]
        dp[i+1][w:] = np.maximum(dp[i][w:], dp[i][:-w] + v)
    return dp[-1][-1]

print(knapsack(N, W))
from collections import defaultdict
N = int(input())
al = list(map(int,input().split()))
cnt = 0
dic = defaultdict(int)
for i in al:
    if 1<= i <= 399:
        dic['gray'] += 1
    elif 400 <= i <= 799:
        dic['brown'] += 1
    elif 800 <= i <= 1199:
        dic['green'] += 1
    elif 1200 <= i <= 1599:
        dic['cyan'] += 1
    elif 1600 <= i <= 1999:
        dic['blue'] += 1
    elif 2000 <= i <= 2399:
        dic['yellow'] += 1
    elif 2400 <= i <= 2799:
        dic['orange'] += 1
    elif 2800 <= i <= 3199:
        dic['red'] += 1
    else:
        cnt += 1


ansmax = len(dic.keys()) + cnt
if ansmax > n:
    ansmax = n


ansmin = len(dic.keys())
if ansmin == 0 and cnt >= 1:
    ansmin = 1

print(ansmin,ansmax)

### FIXED CODE ###

from collections import defaultdict
N = int(input())
al = list(map(int,input().split()))
cnt = 0
dic = defaultdict(int)
for i in al:
    if 1<= i <= 399:
        dic['gray'] += 1
    elif 400 <= i <= 799:
        dic['brown'] += 1
    elif 800 <= i <= 1199:
        dic['green'] += 1
    elif 1200 <= i <= 1599:
        dic['cyan'] += 1
    elif 1600 <= i <= 1999:
        dic['blue'] += 1
    elif 2000 <= i <= 2399:
        dic['yellow'] += 1
    elif 2400 <= i <= 2799:
        dic['orange'] += 1
    elif 2800 <= i <= 3199:
        dic['red'] += 1
    else:
        cnt += 1


ansmax = len(dic.keys()) + cnt
if ansmax > N:
    ansmax = N


ansmin = len(dic.keys())
if ansmin == 0 and cnt >= 1:
    ansmin = 1

print(ansmin,ansmax)
N = int(input())
A = list(map(int, input().split()))
# print(A)

cnt = {}
for a in A:
  if a not in cnt:
    cnt[a] = 1
  else:
  	cnt[a] += 1
  
s, e = 1, 100000
while True:
  while (s not in cnt or cnt[s] <= 1) and s < e:
    s += 1
  while (e not in cnt or cnt[e] <= 1) and s < e:
    e -= 1
  if e < s:
    break
  if s == e and cnt[s] <= 1:
    break
  cnt[s] -= 1
  cnt[e] -= 1

ans = 0
for i in range(1, 100001):
  if i in cnt and cnt[i] > 0:
    ans += 1
    
print(ans)

### FIXED CODE ###

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

cnt = {}
for a in A:
  if a not in cnt:
    cnt[a] = 1
  else:
  	cnt[a] += 1
  
s, e = 1, 100000
while True:
  while (s not in cnt or cnt[s] <= 1) and s < e:
    s += 1
  while (e not in cnt or cnt[e] <= 1) and s < e:
    e -= 1
  if e < s:
    break
  if s == e:
    if s in cnt:
      if cnt[s] <= 1:
        break
    else:
      break
  if s in cnt:
  	cnt[s] -= 1
  if e in cnt:
    cnt[e] -= 1

ans = 0
for i in range(1, 100001):
  if i in cnt and cnt[i] > 0:
    ans += 1
    
print(ans)
N,K = map(int,input().split())
h = []
for _ in range(N):
    h.append(int(input()))
h = sorted(h)
tmp = 0
ans = 1000000000
for i in range(K):
    tmp = h[K+i-1] - h[0+i]
    if(tmp < ans):
        ans = tmp
print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
h = []
for _ in range(N):
    h.append(int(input()))
h = sorted(h)
tmp = 0
ans = 10000000000
loop = N-K+1
for i in range(loop):
    tmp = h[K+i-1] - h[0+i]
    if(tmp < ans):
        ans = tmp
print(ans)
t = raw_input()
h = t//60//60
m = t//60 - h*60
s = t - m*60 - h*60*60
print '%d:%d:%d' % (h, m, s)

### FIXED CODE ###

t = input()
h = t//60//60
m = t//60 - h*60
s = t - m*60 - h*60*60
print '%d:%d:%d' % (h, m, s)
N, M = [int(i) for i in input().split()]
pS = {}

for _ in range(M):
    a, s = [i for i in input().split()]
    if a not in pS:
        pS[a] = {}
        if s == 'AC':
            pS[a]['AC'] = True
        else:
            pS[a]['count'] = 1
    else:
        if s == 'AC':
            pS[a]['AC'] = True
        elif 'AC' not in pS[a]:
            pS[a]['count'] += 1

s = 0
a = 0
for v in pS.values():
    s += v['count']
    if 'AC' in v:
        a += 1
    
print(a, s)

### FIXED CODE ###

N, M = [int(i) for i in input().split()]
pS = {}

for _ in range(M):
    a, s = [i for i in input().split()]
    if a not in pS:
        pS[a] = {}
        if s == 'AC':
            pS[a]['AC'] = True
        else:
            pS[a]['count'] = 1
    else:
        if s == 'AC':
            pS[a]['AC'] = True
        elif 'AC' not in pS[a]:
            pS[a]['count'] += 1

s = 0
a = 0
for v in pS.values():
    if 'AC' in v and 'count' in v:
        s += v['count']
    if 'AC' in v:
        a += 1
    
print(a, s)
N,M = map(int,input().split())
tree = list(map(int,input().split())) #比較用
tree_sub = tree #データの削除用
for i in range(M):
    a,b = map(int,input().split())
    if (tree[a-1] > tree[b-1]) and (int(tree[b-1]) in tree_sub):
        tree_sub[b-1] = 0
    elif (tree[a-1] < tree[b-1]) and (tree[a-1] in tree_sub):
        tree_sub[a-1] = 0
count = 0
for i in range(M):
    if tree_sub[i] != 0:
        count += 1
print(count)

### FIXED CODE ###

N,M = map(int,input().split())
tree = list(map(int,input().split())) #比較用
tree_sub = list(tree) #データの削除用
for i in range(M):
    a,b = map(int,input().split())
    if tree[a-1] > tree[b-1]:
        tree_sub[b-1] = 0
    elif tree[a-1] < tree[b-1]:
        tree_sub[a-1] = 0
    else:
        tree_sub[a-1] = 0
        tree_sub[b-1] = 0
print(len(tree_sub)-tree_sub.count(0))
N,K=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
ans = 0
for i in range(K):
    ans += p[i]
    
print(m)


### FIXED CODE ###

n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
ans = 0
for i in range(k):
    ans += p[i]
print(ans)
import sys
import math
import collections
import bisect
import itertools


import numpy as np
import numba
from numba import njit, b1, i4, i8, f8

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

@njit((i8, i8, i8, i8[:]), cache=True)
def main():
    r, c, k = ns()

    mat = [[0 for _ in range(c + 1)] for __ in range(r + 1)]
    for _ in range(k):
        x, y, v = ns()
        x, y = x - 1, y - 1
        mat[x][y] = v

    dp = [[0] * 4 for _ in range(c + 1)]

    for i in range(r):
        ndp = [[0] * 4 for _ in range(c + 1)]
        for j in range(c):
            for n in range(2, -1, -1):
                dp[j][n + 1] = max(dp[j][n + 1], dp[j][n] + mat[i][j])

            ndp[j][0] = max(dp[j])
            for n in range(4):
                dp[j + 1][n] = max(dp[j + 1][n], dp[j][n])
        dp = ndp

    print(max(dp[c - 1]))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    r, c, k = ns()

    mat = [[0 for _ in range(c + 1)] for __ in range(r + 1)]
    for _ in range(k):
        x, y, v = ns()
        x, y = x - 1, y - 1
        mat[x][y] = v

    dp = [[0] * 4 for _ in range(c + 1)]

    for i in range(r):
        ndp = [[0] * 4 for _ in range(c + 1)]
        for j in range(c):
            for n in range(2, -1, -1):
                dp[j][n + 1] = max(dp[j][n + 1], dp[j][n] + mat[i][j])

            ndp[j][0] = max(dp[j])
            for n in range(4):
                dp[j + 1][n] = max(dp[j + 1][n], dp[j][n])
        dp = ndp

    print(max(dp[c - 1]))


if __name__ == '__main__':
    main()
n = int(input())

w = [0]*n
used = []

for i in range(n):
  w[i] = input()
  
for i in range(n-1):
  if(w[i][-1] != w[i+1][0] or w[i] in used):
    print("No")
    exit()
  used.append(w[i])

if(w[n] not in used):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())

w = [0]*n
used = []

for i in range(n):
  w[i] = input()
  
for i in range(n-1):
  if(w[i][-1] != w[i+1][0] or w[i] in used):
    print("No")
    exit()
  used.append(w[i])
#print(w)

if(w[n-1] not in used):
  print("Yes")
else:
  print("No")
N, M = map(int, input().split())
a = []
for i in range(M):
    a.append(int(input()))

memo = {}
def dfs(height):
    if height in memo:
        return memo[height]
    if height == N:
        memo[height] = 1
        return 1
    elif height > N:
        return 0
    if height in a:
        memo[height] = 0
        return 0
    step1 = dfs(height + 1)
    step2 = dfs(height + 2)
    if step1 == 0 and step2 == 0:
        memo[height] = 0
        return 0
    else:
        memo[height] = step1 + step2
        return step1 + step2
        
print(dfs(0) % 1000000007)

### FIXED CODE ###

N, M = map(int, input().split())
a = {}
for i in range(M):
    a[int(input())] = 1

memo = {
    0: 1
}
queue = [0]
counter = 0
def step(height, n):
    if height + n not in memo:
        memo[height + n] = memo[height]
        queue.append(height + n)
    else:
        memo[height + n] += memo[height]


while counter < len(queue):
    # print(memo, queue, counter)
    item = queue[counter]
    counter += 1
    if item + 1 not in a and item + 1 <= N:
        step(item, 1)
    if item + 2 not in a and item + 2 <= N:
        step(item, 2)

if N not in memo:
    print(0)
else:
    print(memo[N] % 1000000007)
N = float(input())

q = N
r_s = []
while q!=1:
  hoge = (q-1) / (-2)
  if hoge.is_integer():
    r = int(1)
    q = float(hoge)
  else:
    r = int(0)
    q = float(q/(-2))
  
  r_s.append(r)
r_s = r_s.append(1)
r_s = r_s[::-1]

for i in range(len(r_s)):
  print(r_s[i], end="")


### FIXED CODE ###

N = float(input())

if N==0:
  print(0)
else:
  q = N
  r_s = []

  while q!=1:
    hoge = (q-1) / (-2)
    if hoge.is_integer():
      r = int(1)
      q = float(hoge)
    else:
      r = int(0)
      q = float(q/(-2))
  
    r_s.append(r)
  r_s.append(1)
  r_s = r_s[::-1]

  for i in range(len(r_s)):
    print(r_s[i], end="")
def main():
    W, H, x, y, r = [int(i) for i in input().split()]
    if x-r >= 0, x+r <= w , y-r >= 0, y+r <= H :
        print("YES")
    else
        print("No")
    if __name__ == '__main__' :
        main()
    

### FIXED CODE ###

def main() :
    W, H, x, y, r = [int(i) for i in input().split()]

    if ((x-r)>=0) and ((x+r)<=W) and ((y-r)>=0) and ((y+r)<=H) :
        print("Yes")
    else :
        print("No")

if __name__ == '__main__' :
    main()
S,T = input().split()
A,B = int(input().split())
U =input()

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

### FIXED CODE ###

S,T = input().split()
A,B = map(int,input().split())
U = input()
if U == S:
  	print(A-1,B)
elif U == T:
    print(A,B-1)
from numba import njit


@njit(cache=True)
def solve(n, k, arr):
    INF = 1 << 60
    dp = [INF] * (n + 1000)

    dp[1] = 0

    for i in range(1, n):
        for k in range(1, k + 1):
            dp[i + k] = min(dp[i + k], dp[i] + abs(arr[i + k] - arr[i]))

    return dp[n]


n, k = map(int, input().split())
arr = [0] + list(map(int, input().split())) + [0] * 1000

print(solve(n, k, arr))

### FIXED CODE ###

n, k = map(int, input().split())
arr = list(map(int, input().split()))

# dp初期化
dp = [float("inf")] * n
dp[0] = 0

for i in range(1, n):
    dp[i] = min(dp[j] + abs(arr[i] - arr[j]) for j in range(max(i - k, 0), i))

print(dp[n - 1])
import numpy as np 


def resolve():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))

    A = np.empty((N, N))
    for i in range(M):
        pp, ss = map(int, input().split())
        ss -= 1
        pp -= 1
        A[pp][ss] = H[ss]
        A[ss][pp] = H[pp]

    ans = 0
    for j in range(N):
        np_max = np.max(A[j])

        now = H[j]
        if (now > np_max or np_max == 0):
            ans += 1

    print(ans)


resolve()


### FIXED CODE ###

def resolve():
    n, m = map(int, input().split())
    hhh = list(map(int, input().split()))
    nice = [1] * n

    for _ in range(m):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        ha = hhh[a]
        hb = hhh[b]
        if ha <= hb:
            nice[a] = False
        if ha >= hb:
            nice[b] = False

    print(sum(nice))


resolve()
class LargestSquare():
    def __init__(self, map):
        self.max_width = 0
        self.map = []
        self.dp = []
        for r in map:
            self.dp.append([int((x==0)) for x in r])
            self.map.append(r[:])

    def find(self):
        for row in range(1, len(self.dp)):
            for col in range(1, len(self.dp[0])):
                if self.map[row][col] == 1:
                    self.dp[row][col] = 0
                else:
                    self.dp[row][col] = min(self.dp[row-1][col-1], min(self.dp[row-1][col], self.dp[row][col-1])) + 1
                    self.max_width = max(self.max_width, self.dp[row][col])
        return self.max_width * self.max_width



if __name__ == '__main__':
    # ??????????????\???
    f = open('input.txt')
    height, width = [int(x) for x in f.readline().strip().split(' ')]
    map = []
    for _ in range(height):
        map.append([int(x) for x in f.readline().strip().split(' ')])


    # ???????????????
    S = LargestSquare(map)
    result = S.find()

    # ???????????¨???
    print(result)

### FIXED CODE ###

class LargestSquare():
    def __init__(self, map):
        self.max_width = 0
        self.map = []
        self.dp = []
        for r in map:
            self.dp.append([int((x==0)) for x in r])
            self.map.append(r[:])
            if 0 in r:
                self.max_width = 1

    def find(self):
        for row in range(1, len(self.dp)):
            for col in range(1, len(self.dp[0])):
                if self.map[row][col] == 1:
                    self.dp[row][col] = 0
                else:
                    self.dp[row][col] = min(self.dp[row-1][col-1], min(self.dp[row-1][col], self.dp[row][col-1])) + 1
                    self.max_width = max(self.max_width, self.dp[row][col])
        return self.max_width * self.max_width



if __name__ == '__main__':
    # ??????????????\???
    # f = open('input.txt')
    #height, width = [int(x) for x in f.readline().strip().split(' ')]
    height, width = [int(x) for x in input().strip().split(' ')]

    map = []
    for _ in range(height):
        # map.append([int(x) for x in f.readline().strip().split(' ')])
        map.append([int(x) for x in input().strip().split(' ')])


    # ???????????????
    S = LargestSquare(map)
    result = S.find()

    # ???????????¨???
    print(result)
s=input()
a=s
s=a
flag=True
n=len(s)
if s!=s.reversed():
    flag=False
if s[:(n-1)/2]!=s[:(n-1)/2].reversed():
    flag=False
if s[(n+3)/2-1:]!=s[(n+3)/2-1:].reversed():
    flag=False
print("Yes" if flag else "No")



### FIXED CODE ###


s=input()
flag=True
n=len(s)
if s!=s[::-1]:
    flag=False
if s[:(n-1)//2]!="".join(list(reversed(s[:(n-1)//2]))):
    flag=False
if s[(n+3)//2-1:]!="".join(list(reversed(s[(n+3)//2-1:]))):
    flag=False
print("Yes" if flag else "No")
n = int(raw_input())
x = sorted([int(i) for i in raw_input().split(" ")],reverse=True)
print(sum(x[::2]) - sum(x[1::2]))

### FIXED CODE ###

n = int(input())
x = sorted([int(i) for i in input().split(" ")],reverse=True)
print(sum(x[::2]) - sum(x[1::2]))
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect
import numpy as np


def comb(a, b):
    result = 1
    for i in range(b):
        result *= (a - i) / (i + 1)
    return result


def main():
    N = int(input())
    Xs = list(map(int, input().split()))
    Xs = np.array(Xs)

    min_load = None
    for p in range(101):
        load = np.sum((Xs - p) ** 2)
        if min_load is None or min_load > load:
            min_load = load

    print(min_load)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python
from collections import deque, defaultdict
import bisect


def comb(a, b):
    result = 1
    for i in range(b):
        result *= (a - i) / (i + 1)
    return result


def main():
    N = int(input())
    Xs = list(map(int, input().split()))

    min_load = None
    for p in range(101):
        load = sum([(x - p) ** 2 for x in Xs])
        if min_load is None or min_load > load:
            min_load = load

    print(min_load)


if __name__ == '__main__':
    main()
import sys
a=[0,0]+[1]*10**6
for i in range(999):
 if a[i]:a[i*2::i]=[0 for j in a[i*2::i]]
for e in sys.stdin:print(int(e)-len([i for i in li[:int(e)+1]if i]))


### FIXED CODE ###

import sys
m=500000;a=[1]*m
for i in range(3,999,2):
 if a[i//2]:a[i*i//2::i]=[0]*len(a[i*i//2::i])
p=[]
for i in range(m*2):p+=[i-1 if i<4 else p[i-1]+[0,a[i//2]][i%2]]
for e in sys.stdin:print(p[int(e)])
n = int(input())

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

ans = 0
for i in range(n):
  ai = a[i]
  pre_ai = 0
  if i != 0:
    pre_ai = a[i-1]
    
  ans += b[ai]
  if ai - pre_ai = 1:
    ans += c[pre_ai]
    
print (ans)
  

### FIXED CODE ###

n = int(input())

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

ans = 0
for i in range(n):
  ai = a[i] -1
  pre_ai = -10
  if i != 0:
    pre_ai = a[i-1] -1
    
  ans += b[ai]
  if ai - pre_ai == 1:
    ans += c[pre_ai]
    
print (ans)
N, M = map(int, input().split())
ST = [list(map(int, input().split())) for _ in range(M)]
ST.sort()
Edge_out = [[] for _ in range(N+1)]
Edge_in = [[] for _ in range(N+1)]
for s, t in ST:
    Edge_out[s].append(t)
    Edge_in[t].append(s)

P_node = [0] * (N+1)  # 辿り着く確率
P_edge = [0] * (N+1)  # そこから出る辺を使う確率
P_node[1] = 1
for v, edge_out in enumerate(Edge_out[1:-1], 1):
    deg = len(edge_out)
    p = P_node[v] / deg
    P_edge[v] = p
    for u in edge_out:
        P_node[u] += p

E_node_in = [0] * (N+1)  # ノードに到着するまでの辺の個数の期待値

for v, edge_in in enumerate(Edge_in[2:], 2):
    p_sum = 0
    su = 0
    for u in edge_in:
        p = P_edge[u]
        p_sum += p
        su += p * E_node_in[u]
    su /= p_sum
    su += 1
    E_node_in[v] = su

E_node_out = [0] * (N+1)  # ノードから出発したあと通る辺の個数の期待値

for v in range(N-1, 0, -1):
    edge_out = Edge_out[v]
    su = 0
    for u in edge_out:
        su += E_node_out[u]
    su /= len(edge_out)
    su += 1
    E_node_out[v] = su


# ans = e_all = E_node_out[1]
# for s, t in ST:
#     p_st = P_edge[s]
#     e_st = E_node_in[s] + E_node_out[t] + 1
#     print("e_st,p_st=",e_st,p_st)
#     a = (e_all - p_st*e_st) / (1 - p_st)
#     print("s,t,a=",s,t,a)
#     ans = min(ans, a)

ans = 0
for s, t in ST:
    p_s = P_node[s]
    p_st = P_edge[s]
    deg = len(Edge_out[s])
    if deg==1:
        continue
    e = (E_node_out[s] - (1+E_node_out[t]) / deg) * (deg / (deg - 1))
    a = p_s * (e - E_node_out[s])
    #print("s,t,a=", s, t, a)
    ans = min(ans, a)
print(ans + E_node_out[1])


### FIXED CODE ###

N, M = map(int, input().split())
ST = [list(map(int, input().split())) for _ in range(M)]
ST.sort()
Edge_out = [[] for _ in range(N+1)]
Edge_in = [[] for _ in range(N+1)]
for s, t in ST:
    Edge_out[s].append(t)
    Edge_in[t].append(s)

P_node = [0] * (N+1)  # 辿り着く確率
P_edge = [0] * (N+1)  # そこから出る辺を使う確率
P_node[1] = 1
for v, edge_out in enumerate(Edge_out[1:-1], 1):
    deg = len(edge_out)
    p = P_node[v] / deg
    P_edge[v] = p
    for u in edge_out:
        P_node[u] += p

# E_node_in = [0] * (N+1)  # ノードに到着するまでの辺の個数の期待値
#
# for v, edge_in in enumerate(Edge_in[2:], 2):
#     p_sum = 0
#     su = 0
#     for u in edge_in:
#         p = P_edge[u]
#         p_sum += p
#         su += p * E_node_in[u]
#     su /= p_sum
#     su += 1
#     E_node_in[v] = su

E_node_out = [0] * (N+1)  # ノードから出発したあと通る辺の個数の期待値

for v in range(N-1, 0, -1):
    edge_out = Edge_out[v]
    su = 0
    for u in edge_out:
        su += E_node_out[u]
    su /= len(edge_out)
    su += 1
    E_node_out[v] = su


# ans = e_all = E_node_out[1]
# for s, t in ST:
#     p_st = P_edge[s]
#     e_st = E_node_in[s] + E_node_out[t] + 1
#     print("e_st,p_st=",e_st,p_st)
#     a = (e_all - p_st*e_st) / (1 - p_st)
#     print("s,t,a=",s,t,a)
#     ans = min(ans, a)

ans = 0
for s, t in ST:
    p_s = P_node[s]
    #p_st = P_edge[s]
    deg = len(Edge_out[s])
    if deg==1:
        continue
    e = (E_node_out[s] - (1+E_node_out[t]) / deg) * (deg / (deg - 1))
    a = p_s * (e - E_node_out[s])
    #print("s,t,a=", s, t, a)
    ans = min(ans, a)
print(ans + E_node_out[1])
stack = []
while True:
    a = raw_input()
    if a == '0 0': break
    for i, b in enumerate(a.split()):
        if i==0:
            x=int(b)
        else:
            y=int(b)
        if x<=y:
            stack.append(x)
            stack.append(y)
        else:
            stack.append(y)
            stack.append(x)
for i, c in enumerate(stack):
    w=i%2
    if w==0:
        x=int(c)
    else:
        y=int(c)
        print x,y

### FIXED CODE ###

while True:
	[a,b]=raw_input().split()
	x=int(a)
	y=int(b)
	if x==y==0:break
	if x<=y:
		print a,b
	else:
		print b,a