def Swapped(last, next):
  if not last.now and not next.was and len(last.was) == len(next.now):
    cnt = len(last.was)
    for i in range(cnt):
      match = True
      for j in range(cnt):
        if last.was[j] != next.now[(i + j) % cnt]:
          match = False
          break;
      if match: return True
  if not last.was and not next.now and len(last.now) == len(next.was):
    cnt = len(last.now)
    for i in range(cnt):
      match = True
      for j in range(cnt):
        if last.now[i] != next.was[(i + j) % cnt]:
          match = False
          break;
      if match: return True
  return False