output_description: If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S W
attempt: import sys
  
  input = lambda: sys.stdin.readline().rstrip()
  t = int(input())
  for _ in range(t):
      c, d = map(int, input().split())
      XX = [int(i) for i in input().split()]
      Y = []
      YY = []
      X = [0] * c
      for i, x in enumerate(XX):
          if x > 0:
              Y.append(x)
              X[i + 1] = x
          else:
              YY.append((-x, i + 1))
  
      Y.sort()
      Y = [0] + Y
      YY.sort()
      for x, i in YY:
          X[i] = Y[x - 1] + 1
          Y = Y[:x] + [Y[x - 1] + 1] + Y[x:]
  
      edge = [[] for i in range(c)]
      E = [0] * d
      for i in range(d):
          u, v = map(int, input().split())
          edge[u - 1].append([v - 1, i])
          edge[v - 1].append([u - 1, i])
  
      D = [[] for i in range(1000)]
      for i in range(1, c):
          D[X[i]].append(i)
      for i in range(1, 1000):
          if not D[i]:
              continue
          else:
              for goal in D[i]:
                  t_root = 0
                  dist = float("inf")
                  t_ind = 0
                  for root, ind in edge[goal]:
                      if X[root] < dist:
                          t_root = root
                          dist = X[root]
                          t_ind = ind
                  E[t_ind] = i - dist
      for i in range(d):
          if E[i] == 0:
              E[i] = str(10**6)
          else:
              E[i] = str(E[i])
      ans = " ".join(E)
      print("Case #" + str(_ + 1) + ": " + ans)
  
problem_description: Statement
  
  There are S sheep and W wolves.
  
  If the number of wolves is greater than or equal to that of sheep, the wolves
  will attack the sheep.
  
  If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`.
samples: [{"input": "4 5", "output": "unsafe\n    \n\nThere are four sheep and five wolves. The number of wolves is not less than\nthat of sheep, so they will attack them.\n\n* * *"}, {"input": "100 2", "output": "safe\n    \n\nMany a sheep drive away two wolves.\n\n* * *"}, {"input": "10 10", "output": "unsafe"}]