Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
import socket

hostname = socket.gethostname()

if hostname == 'F551C':
    sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    S = read_str()
    T = read_str()
    n = len(S)
    res = 'Yes'
    for i in range(n):
        for j in range(n):
            if S[i] != S[j] and T[i] == T[j]:
                res = 'No'
            if S[i] == S[j] and T[i] != T[j]:
                res = 'No'
    print(res)


main()


### FIXED CODE ###

import sys
import socket

hostname = socket.gethostname()

if hostname == 'F551C':
    sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    S = read_str()
    T = read_str()
    n = len(S)
    res = 'Yes'
    A = [0] * n
    B = [0] * n
    vu = {}
    for i in range(n):
        if S[i] in vu:
            A[i] = vu[S[i]]
        else:
            vu[S[i]] = i
            A[i] = vu[S[i]]

    vu = {}
    for i in range(n):
        if T[i] in vu:
            B[i] = vu[T[i]]
        else:
            vu[T[i]] = i
            B[i] = vu[T[i]]

    if A != B:
        res = 'No'

    # for i in range(n):
    #     for j in range(n):
    #         if S[i] != S[j] and T[i] == T[j]:
    #             res = 'No'
    #         if S[i] == S[j] and T[i] != T[j]:
    #             res = 'No'
    print(res)


main()
### BUGGY CODE ###

import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def make_adjlist_d(n, edges):
    res = [[] for _ in range(n+1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
    return res


def main():
    N, M = NMI()
    edges = [NLI() for _ in range(M)]
    S, T = NMI()
    tree = make_adjlist_d(N, edges)

    tree2 = [[] for _ in range(N+1)]
    for i in range(1, N+1):
        gotos = tree[i]
        for goto in gotos:
            tree2[i] += tree[goto]

    tree2 = [set(tr) for tr in tree2]

    tree3 = [[] for _ in range(N+1)]
    for i in range(1, N+1):
        gotos = tree2[i]
        for goto in gotos:
            tree3[i] += tree[goto]

    tree3 = [set(tr) for tr in tree3]

    stack = deque()
    stack.append(S)
    seen = [-1] * (N+1)
    seen[S] = 0
    while stack:
        now = stack.popleft()
        now_step = seen[now]
        for goto in tree3[now]:
            if seen[goto] >= 0:
                continue

            stack.append(goto)
            seen[goto] = now_step + 1

    print(seen[T])



if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def make_adjlist_d(n, edges):
    res = [[] for _ in range(n+1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
    return res


def main():
    N, M = NMI()
    edges = [NLI() for _ in range(M)]
    S, T = NMI()

    tree = [[] for _ in range(3*N+1)]
    for e in edges:
        tree[e[0]].append(e[1]+N)
        tree[e[0]+N].append(e[1]+2*N)
        tree[e[0]+2*N].append(e[1])

    stack = deque()
    stack.append(S)
    seen = [-1] * (3*N+1)
    seen[S] = 0
    while stack:
        now = stack.popleft()
        now_step = seen[now]
        for goto in tree[now]:
            if seen[goto] >= 0:
                continue

            stack.append(goto)
            seen[goto] = now_step + 1

    print(seen[T]//3)



if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
INF = 10**10
MOD = 10**9 + 7
sys.setrecursionlimit(100000000)
from functools import lru_cache
from itertools import permutations
from math import factorial


def main():
    n,a = map(int,input().split())
    x = list(map(int,input().split()))
    dp = [[[0] * (n * a + 1) for _ in range(n + 1)] for _ in range(n + 1)]

    for i in range(n + 1):
        dp[i][0][0] = 1

    for i in range(n):
        num = x[i]
        for j in range(1,n + 1):
            for s in range(n * a + 1):
                if s - num >= 0:
                    dp[i + 1][j][s] = dp[i][j][s] + dp[i][j - 1][s - num]
                else:
                    dp[i + 1][j][s] = dp[i][j][s]
    
    ans = 0
    for i in range(1,n + 1):
        ans += dp[-1][i][i * a]
    print(ans)
    

if __name__=='__main__':
    main() 

### FIXED CODE ###

import sys
input = sys.stdin.readline
INF = 10**10
MOD = 10**9 + 7
sys.setrecursionlimit(100000000)
from functools import lru_cache
from itertools import permutations
from math import factorial


def main():
    n,a = map(int,input().split())
    x = list(map(int,input().split()))
    dp = [[[0] * (n * a + 1) for _ in range(n + 1)] for _ in range(n + 1)]

    for i in range(n + 1):
        dp[i][0][0] = 1

    for i in range(n):
        num = x[i]
        for j in range(1,n + 1):
            for s in range(n * a + 1):
                if s - num >= 0:
                    dp[i + 1][j][s] = dp[i][j][s] + dp[i][j - 1][s - num]
                else:
                    dp[i + 1][j][s] = dp[i][j][s]
    
    ans = 0
    for i in range(1,n + 1):
        ans += dp[-1][i][i * a]
    print(ans)
    

if __name__=='__main__':
    main()
### BUGGY CODE ###

# coding: utf-8
import fractions

n = int(input().rstrip())
numbers = [int(i) for i in input().rstrip().split(" ")]

l_list = [numbers[0]]
for i in range(1, n):
    l_list.append(fractions.gcd(l_list[i - 1], numbers[i]))

r_list = [numbers[len(numbers) - 1]]
for i in reversed(range(0, n - 1)):
    r_list.insert(0, fractions.gcd(r_list[0], numbers[i]))

ans = 0
for i in range(n):
    l = 0
    if i > 0:
        l = l_list[i - 1]
    r = 0
    if i < n - 1:
        r = r_list[i + 1]
    if l == 0:
        l = r
    if r == 0:
        r = l
    ans = max(ans, fractions.gcd(l, r))
print(ans)


### FIXED CODE ###

# coding: utf-8
import fractions

n = int(input().rstrip())
numbers = [int(i) for i in input().rstrip().split(" ")]

l_list = [0 for i in range(n)]
l_list[0] = numbers[0]
for i in range(1, n):
    l_list[i] = fractions.gcd(l_list[i-1], numbers[i])

r_list = [0 for i in range(n)]
r_list[n-1] = numbers[n-1]
for i in reversed(range(0, n - 1)):
    r_list[i] = fractions.gcd(r_list[i+1], numbers[i])

ans = 0
for i in range(n):
    l = 0
    if i > 0:
        l = l_list[i - 1]
    r = 0
    if i < n - 1:
        r = r_list[i + 1]
    if l == 0:
        l = r
    if r == 0:
        r = l
    ans = max(ans, fractions.gcd(l, r))
print(ans)
### BUGGY CODE ###

# atcoder Educational DP contest/DP まとめコンテスト
# B-Frog2

def get_inputs():
    [n, k] = [int(x) for x in input().split()]
    h = list(map(int, input().split()))
    
    return n, k, h


if __name__ == "__main__":
    # 入力を受け取る
    # n 足場の数 2<= N <= 10**5
    # k k本先の足場まで飛ぶことができる 1<=K<=100
    # h 足場の高さ 配列
    n, k, h = get_inputs()
    
    # dp[i]はi番目(0<=i<n)の足場に到達するまでに必要な最小コスト
        
    dp = [10000000000] * (n + k)        # k個分を含む配列を用意し最大値で初期化する
    
    h = h + [100000] * k
    
    dp[0] = 0                             # 0番目の足場はコスト0
    
    # 足場iからj個先まで行く場合の最小コストを求める
    for i in range(0, n - 1):
        for j in range(1, k + 1):
            dp[i + j] = min(dp[i] + abs(h[i + j] - h[i]), dp[i + j])
    
    print(dp[n-1])
      

### FIXED CODE ###

# atcoder Educational DP contest/DP まとめコンテスト
# B-Frog2

def get_inputs():
    [n, k] = [int(x) for x in input().split()]
    h = list(map(int, input().split()))
    
    return n, k, h


if __name__ == "__main__":
    # 入力を受け取る
    # n 足場の数 2<= N <= 10**5
    # k k本先の足場まで飛ぶことができる 1<=K<=100
    # h 足場の高さ 配列
    n, k, h = get_inputs()
    
    ########## first try
    # for文の二重ループではTLEになってしまう
    # dp = [10000000000] * (n + k)        # k個分を含む配列を用意し最大値で初期化する
    # h= h + [100000] * k
    # dp[0] = 0                             # 0番目の足場はコスト0
    # 足場iからj個先まで行く場合の最小コストを求める
    # for i in range(0, n - 1):
    #    for j in range(1, k + 1):
    #        dp[i + j] = min(dp[i] + abs(h[i + j] - h[i]), dp[i + j])
    # print(dp[n-1])
    
    ########## second try
    # 前案より速度は改善したが、まだ一部の問題でTLEになる
    # dp = [10**9] * n
    # dp[0] = 0
    #
    # for i in range(1, n):
    #     mc = 10**9
    #     for j in range(max(0, i - k), i):
    #         mc = min(mc, dp[j] + abs(h[i] - h[j]))
    #    dp[i] = mc
    # print(dp[n-1])
    
    ########## third try
    # 二重ループを内包表記表現に変更
    # zipを使うのがミソ
    
    dp = [10**9] * n
    dp[0] = 0
    for i in range(1, n):
        j = max(0, i - k)
        dp[i] = min([dd + abs(h[i] - hh) for (dd, hh) in zip(dp[j:i], h[j:i])])
    print(dp[n-1])
### BUGGY CODE ###

N = int(input())
while 9 < N:
  tmp = 0
  for i in reversed(range(len(str(N)))):
    n, N = N//(10**i), N%(10**i)
    tmp += n
  N = tmp 
if N%9 == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = input()
M = N
tmp = 0
for i in range(len(N)):
  n, M = int(M[0]), M[1:]
  tmp += n
if tmp%9 == 0:
  print("Yes")
else:
  print("No")
### BUGGY CODE ###

n, m = map(int, raw_input().split())
l = map(int, raw_input().split())
dp = [False for i in range(n + 1)]
for i in range(m):
    if l[i] <= n: dp[l[i]] = True
cnt = 1
while 1:
    if dp[n]: break
    ndp = [False for i in range(n + 1)]
    for i in range(n+1):
        if dp[i]:
            ndp[i] = True
            for j in range(m):
                if i + l[j] <= n: ndp[i+l[j]] = True
    cnt += 1
    dp = ndp
print cnt

### FIXED CODE ###

n, m = map(int, raw_input().split())
l = map(int, raw_input().split())
INF = 1<<31
dp = [INF]*(n+1)
dp[0] = 0
for c in l:
    for i in range(n-c+1):
        if dp[i] != INF:
            dp[i + c] = min(dp[i] + 1, dp[i + c])
print dp[n]
### BUGGY CODE ###

q = int(input())


def isPrime(n):
    if n == 1:
        return 0
    if n == 2:
        return 1
    if n % 2 == 0:
        return 0
    m = int(n**0.5)+1
    for p in range(3, m, 2):
        if n % p == 0:
            return 0
    return 1


prime = [0]*(10**5+1)
for i in range(1, 10**5+1, 2):
    prime[i] = isPrime(i) & isPrime((i+1)//2)
# print(prime)

ans = []
for _ in range(q):
    l, r = map(int, input().split())
    cnt = sum(prime[l:r+1])
    ans.append(cnt)


for i in range(q):
    print(ans[i])

### FIXED CODE ###

n_max = 10 ** 5 + 10
sieve = [0, 0] + [1]*n_max
m = 2
while m * m <= n_max:
    if sieve[m]:
        for n in range(2*m, n_max, m):
            sieve[n] = 0
    m += 1

ok = [0]*n_max
cums = [0]
for n in range(n_max):
    if sieve[n] and sieve[(n+1)//2]:
        ok[n] = 1
    cums.append(cums[-1]+ok[n])

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(cums[r+1]-cums[l])
### BUGGY CODE ###

import heapq
from collections import defaultdict


class Dijkstra(object):

    """ 使用例
    dik = Dijkstra()
    edge = defaultdict(list)
    edge[(1, 1)].append([1, (1, 2)])
    edge[(1, 2)].append([1, (1, 1)])
    edge[(1, 2)].append([2, (2, 1)])
    edge[(2, 1)].append([2, (1, 2)])
    edge[(2, 1)].append([5, (2, 2)])
    edge[(2, 2)].append([5, (2, 1)])
    edge[(2, 2)].append([3, (1, 2)])
    edge[(1, 2)].append([3, (2, 2)])

    s0 = (1, 1)
    ans = dik(s0, edge)

    """

    def __init(self):
        pass

    def __call__(self, s0, edge):

        # s0:始点 (,,,)
        # edge[(,,,)] = [コスト、(,,,)], [コスト、(,,,)]

        d = defaultdict(lambda: float('inf'))
        used = defaultdict(lambda: True)

        edgelist = edge[s0]
        heapq.heapify(edgelist)

        d[s0] = 0
        used[s0] = False

        while len(edgelist):
            minedge = heapq.heappop(edgelist)
            if not used[minedge[1]]:
                continue
            v = minedge[1]
            d[v] = minedge[0]
            used[v] = False

            for e in edge[v]:
                if used[e[1]]:
                    if d[e[1]] <= d[v] + e[0]:
                        continue
                    heapq.heappush(edgelist, [d[v] + e[0], e[1]])

        return d


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

s_max = 2500
S = min(S, s_max)

dik = Dijkstra()
edge = defaultdict(list)
s0 = (1, S)

for m in range(1, M + 1):
    U, V, A, B = map(int, input().split())
    for s in range(A, s_max + 1):
        edge[(U, s)].append([B, (V, s - A)])
        edge[(V, s)].append([B, (U, s - A)])

for n in range(1, N + 1):
    C, D = map(int, input().split())
    for s in range(s_max + 1):
        s1 = min(s + C, s_max)
        edge[(n, s)].append([D, (n, s1)])

d = dik(s0, edge)

for n in range(2, N + 1):
    ans = []
    for s in range(s_max + 1):
        ans.append(d[(n, s)])
    print(min(ans))


### FIXED CODE ###

import heapq
import sys
input = sys.stdin.readline
 
INF = 10 ** 18
 
class Edge():
    def __init__(self, end, cost, time):
        self.end = end
        self.cost = cost
        self.time = time
 
dp = []
h = []
 
def push(t, v, x):
    if x < 0:
        return
    if dp[v][x] <= t:
        return
    dp[v][x] = t
    heapq.heappush(h, (t, v, x))
 
def dijkstra(n, G, cd, start, s, max_s):
    global dp
    dp = [[INF for j in range(max_s+1)] for i in range(n)] 
    push(0, start, s)
 
    while h:
        # 使っていない頂点のうち、現時点で最も到達短時間が短いものを選びvとする
        t, v, x = heapq.heappop(h)
        if dp[v][x] < t:
            continue
        # 両替
        if x < max_s:
            push(t+cd[v][1], v, min(x+cd[v][0], max_s))
        # vから到達可能な頂点について、到達時間が短くなれば更新
        for e in G[v]:
            push(t+e.time, e.end, x-e.cost)
 
 
n, m, s = map(int, input().split())
uvab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(n)]
 
es = [[] for i in range(n)]
max_s = 50 * (n-1)
 
for u, v, a, b in uvab:
    es[u-1].append(Edge(v-1,a,b))
    es[v-1].append(Edge(u-1,a,b))
 
dijkstra(n, es, cd, 0, min(max_s,s), max_s)
 
for i in range(1, n):
    print(min(dp[i]))
### BUGGY CODE ###

import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
to = defaultdict(list)
V = 100005
X = []
for i in range(N):
	x, y = rl()
	X.append(x)
	y += V
	to[x].append(y)
	to[y].append(x)

visited = set()
nums = [0, 0]
def dfs(n):
	if n in visited: return
	visited.add(n)
	if n < V:
		nums[0] += 1
	else:
		nums[1] += 1
	for m in to[n]:
		dfs(m)

ans = 0
for x in X:
	nums[0] = 0
	nums[1] = 0
	dfs(x)
	ans += nums[0]*nums[1]
print(ans-N)



### FIXED CODE ###

import sys, math
from collections import defaultdict, deque, Counter
# from bisect import bisect_left, bisect_right
# from itertools import combinations, permutations, product
# from heapq import heappush, heappop
# from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
to = defaultdict(list)
V = 100005
X = []
for i in range(N):
	x, y = rl()
	X.append(x)
	y += V
	to[x].append(y)
	to[y].append(x)

ans = 0
visited = {}
for x in X:
	if x in visited: continue
	nx, ny = 0, 0
	queue = deque()
	queue.append(x)
	visited[x] = 1
	while queue:
		n = queue.pop()
		if n < V:
			nx += 1
		else:
			ny += 1
		for m in to[n]:
			if m in visited:
				continue
			visited[m] = 1
			queue.append(m)
	ans += nx*ny
print(ans-N)
### BUGGY CODE ###

#!python3

import numpy as np

LI = lambda: list(map(int, input().split()))

# input
S = input()

MOD = 10 ** 9 + 7


def main():
    n = len(S)
    m = 5
    w = []
    p = 1
    for i in range(n):
        s = S[-1 - i]
        if s == "?":
            w.append(p)
        else:
            m = (m - int(s) * p) % 13
        p = p * 10 % 13

    n = len(w)
    l1 = np.zeros(13, dtype=int)
    l1[0] = 1
    for i in range(1, n + 1):
        l2 = np.zeros(13, dtype=int)
        for j in range(10):
            x = w[i - 1] * j % 13
            l2 += np.roll(l1, x)
            l2 %= MOD
        l1 = l2
    
    ans = l1[m]
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!python3

LI = lambda: list(map(int, input().split()))

# input
S = input()

MOD = 10 ** 9 + 7


def main():
    n = len(S)
    m = 5
    w = []
    p = 1
    for i in range(n):
        s = S[-1 - i]
        if s == "?":
            w.append(p)
        else:
            m = (m - int(s) * p) % 13
        p = p * 10 % 13

    n = len(w)
    l1 = [0] * 13
    l1[0] = 1
    for i in range(1, n + 1):
        l2 = [0] * 13
        for j in range(10):
            x = w[i - 1] * j % 13
            for k in range(13):
                t = (x + k) % 13
                l2[t] += l1[k]
        l1 = [y % MOD for y in l2]
    
    ans = l1[m]
    print(ans)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys

H, W, d = map(int, input().split())

color = 'RGBY'
ret = [['' for _ in range(W)] for _ in range(H)]
flag = [[0b1111 for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        for k in range(4):
            if flag[i][j] & 2 ** k:
                flag[i][j] &= ~(2 ** k)
                ret[i][j] = color[k]

                for p in range(d + 1):
                    q = d - p

                    if i - p >= 0 and j - q >= 0: flag[i - p][j - q] &= ~(2 ** k)
                    if i + p < H and j - q >= 0: flag[i + p][j - q] &= ~(2 ** k)
                    if i - p >= i and j + q < W: flag[i - p][j + q] &= ~(2 ** k)
                    if i + p < H and j + q < W: flag[i + p][j + q] &= ~(2 ** k)
                break

for a in ret:
    print(''.join(a))


### FIXED CODE ###


H, W, d = map(int, input().split())

ret = [['RGBY'[(i + j) // d % 2 + (i - j) // d % 2 * 2] for j in range(W)] for i in range(H)]

for a in ret:
    print(''.join(a))
### BUGGY CODE ###

import numpy as np

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

As = np.array(list(map(int,input().split())))
Bs = []
Cs = []
for i in range(M):
	inputs = list(map(int,input().split()))
	Bs.append(inputs[0])
	Cs.append(inputs[1])

for j in range(1, M + 1):
	for n in range(Bs[j - 1]):
		minArg = As.argmin()
		if As[minArg] < Cs[j - 1]:
			As[minArg] = Cs[j - 1]
print(sum(As))


### FIXED CODE ###

import numpy as np

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

As = sorted(list(map(int,input().split())))
BCs = []

for i in range(M):
	inputs = list(map(int,input().split()))
	BCs.append(inputs)
BCs = sorted(BCs, reverse = True, key=lambda x: x[1])

index = 0
for bc in BCs:
	b = bc[0]
	c = bc[1]

	for n in range(b):
		try:
			if As[index] < c:
				As[index] = c
				index += 1
			else:
				break
		except:
			break
print(sum(As))
### BUGGY CODE ###

#coding : utf-8

import os
import sys

def except_i(a, i):
	return a[0:i] + a[i+1:len(a)]

N = int(input())

A = []

for i in range(N):
	A.append(int(input()))


for i in range(N):
	print(max(except_i(A, i)))



### FIXED CODE ###

#coding : utf-8

import os
import sys

N = int(input())

A = []

for i in range(N):
	A.append(int(input()))

X = [[A[i], i] for i in range(N)]


X.sort(key = lambda x: x[0], reverse=True)


for i in range(N):
	if i != X[0][1]:
		print(X[0][0])
	else:
		print(X[1][0])
### BUGGY CODE ###

import sys
input = sys.stdin.buffer.readline

N, M = map(int, input().split())
ABs = [tuple(map(int, input().split())) for _ in range(M)]

if M % 2 == 1:
    print(-1)
    exit()

inv_ABs = [dict() for _ in range(N+1)]
for i, (A, B) in enumerate(ABs):
    inv_ABs[A][B] = i
    inv_ABs[B][A] = i

reverse_ABs = [False] * M

iseven = [True] * (N+1)
for A, B in ABs:
    if not iseven[B]: # B -> A
        iseven[B] = True
        reverse_ABs[inv_ABs[A][B]] = True
    else:
        iseven[A] = (not iseven[A])

odd_nodes = set((i for i, e in enumerate(iseven) if not e))


def bfs():
    global odd_nodes, reverse_ABs
    root = odd_nodes.pop()
    q = [root]
    parent = [0] * (N+1)
    parent[root] = root
    while q:
        nq = []
        for v in q:
            for nv in inv_ABs[v]:
                if parent[nv] == 0:
                    parent[nv] = v
                    nq.append(nv)
                if nv in odd_nodes: #reverse path between nv and root
                    v = nv
                    while parent[v] != v:
                        reverse_ABs[inv_ABs[parent[v]][v]] = (not reverse_ABs[inv_ABs[parent[v]][v]])
                        v = parent[v]
                    odd_nodes.remove(nv)
                    return
        q = nq


while odd_nodes:
    bfs()

for rflg, (A, B) in zip(reverse_ABs, ABs):
    if rflg:
        print(B, A)
    else:
        print(A, B)

### FIXED CODE ###

# Euler Tourとimos法で殴る。
from bisect import bisect


N, M = map(int, input().split())
ABs = [tuple(map(int, input().split())) for _ in range(M)]

if M % 2 == 1:
    print(-1)
    exit()

inv_ABs = [dict() for _ in range(N+1)]
for i, (A, B) in enumerate(ABs):
    inv_ABs[A][B] = i
    inv_ABs[B][A] = i

reverse_ABs = [False] * M

iseven = [True] * (N+1)
for A, B in ABs:
    if not iseven[B]: # B -> A
        iseven[B] = True
        reverse_ABs[inv_ABs[A][B]] = True
    else:
        iseven[A] = (not iseven[A])


# Euler Tour
start = 1
stack = [start]
parent = [0] * (N+1)
parent[start] = start
et = []
while stack:
    v = stack.pop()
    if v >= 0:
        et.append(v)
        for nv in inv_ABs[v]:
            if parent[nv] == 0:
                parent[nv] = v
                stack.append(~nv)
                stack.append(nv)
    else:
        et.append(parent[~v])

# print(et)

imos = [0] * (len(et) + 1)
odd_nodes = set((i for i, e in enumerate(iseven) if not e))
for i, v in enumerate(et):
    if v in odd_nodes:
        odd_nodes.remove(v)
        imos[i] += 1
    imos[i+1] += imos[i]

for i in range(len(et) - 1):
    if imos[i] % 2 == 1:
        reverse_ABs[inv_ABs[et[i]][et[i+1]]] = (not reverse_ABs[inv_ABs[et[i]][et[i+1]]] )

for rflg, (A, B) in zip(reverse_ABs, ABs):
    if rflg:
        print(B, A)
    else:
        print(A, B)
### BUGGY CODE ###

N = int(input())
A = [int(x) for x in input().split()]

from itertools import accumulate

B = list(accumulate(A, lambda a, b: a + b))
C = list(accumulate(A, lambda a, b: a ^ b))

ans = 0
for l in range(0, N):
    for r in range(l, N):
        bsum = B[r] - B[l - 1] if l != 0 else B[r]
        csum = C[r] ^ C[l - 1] if l != 0 else C[r]
        if bsum == csum:
            ans += 1

print(ans)



### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]

ans_plus = ans = 0
l = r = 0
sum = A[0]
xorsum = A[0]

while 1:
    if sum == xorsum:
        ans_plus += 1
        ans += ans_plus
        if r == N - 1:
            break
        else:
            r += 1
        sum += A[r]
        xorsum ^= A[r]
    else:
        ans_plus -= 1
        sum -= A[l]
        xorsum ^= A[l]
        l += 1

print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
Created on Thu Sep  5 14:58:17 2019

@author: Owner
"""

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

cnt = 0

for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z == S:
                cnt+=1
print(cnt)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Thu Sep  5 14:58:17 2019

@author: Owner
"""

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

cnt = 0

for x in range(K+1):
    for y in range(K+1):
        if 0 <= S-(x+y) and S-(x+y)<=K :
            cnt+=1
print(cnt)