qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
def main():
    import sys
    readline = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read
    N = int(readline())
    R = [[int(i) for i in r.split()] for r in read().rstrip().split(b'\n')]
    G = [[] for _ in range(N)]
    edge = {}
    ans_key = []
    for a, b in R:
        G[a-1].append(b-1)
        G[b-1].append(a-1)
        edge[(a-1, b-1)] = -1
        ans_key.append((a-1, b-1))
    max_g = max(len(g) for g in G)

    def dfs(max_g):
        todo = [0]
        seen = [False]*N
        seen[0] = True
        par = [-1]*N
        while todo:
            u = todo.pop()
            k = 1
            c = edge[(par[u], u)] if u != 0 else 0
            for v in G[u]:
                if seen[v]:
                    continue
                seen[v] = True
                todo.append(v)
                par[v] = u
                if u < v:
                    edge[(u, v)] = k
                else:
                    edge[(v, u)] = k
                k += 1
                if k == c:
                    k += 1

    dfs(max_g)
    print(max_g)
    for k in ans_key:
        print(edge[k])


if __name__ == '__main__':
    main()


# Fixed code:
def main():
    import sys
    readline = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read
    N = int(readline())
    R = [[int(i) for i in r.split()] for r in read().rstrip().split(b'\n')]
    G = [[] for _ in range(N)]
    edge = {}
    ans_key = []
    for a, b in R:
        G[a-1].append(b-1)
        G[b-1].append(a-1)
        edge[(a-1, b-1)] = -1
        ans_key.append((a-1, b-1))
    max_g = max(len(g) for g in G)

    def dfs(max_g):
        todo = [0]
        seen = [False]*N
        seen[0] = True
        par = [-1]*N
        while todo:
            u = todo.pop()
            k = 0
            c = edge[(par[u], u)] if u != 0 else 0
            for v in G[u]:
                if seen[v]:
                    continue
                seen[v] = True
                todo.append(v)
                par[v] = u
                k += 1
                if k == c:
                    k += 1
                    if max_g < k:
                        k = 1
                if u < v:
                    edge[(u, v)] = k
                else:
                    edge[(v, u)] = k

    dfs(max_g)
    print(max_g)
    for k in ans_key:
        print(edge[k])


if __name__ == '__main__':
    main()
# Buggy code:
from collections import deque

N = int(input())
graph = [[] for _ in range(N)]

for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append([b, i])
    graph[b].append([a, i])
print(graph)

ans = [0] * (N - 1)
q = deque([[1, 0, -1]])
while q:
    node, pcol, p_node = q.popleft()
    cnt = 1
    for n_node in graph[node]:
        if n_node[0] == p_node: continue
        if cnt == pcol: cnt += 1
        ans[n_node[1]] = cnt
        q.append([n_node[0], cnt, node])
        cnt += 1
print(ans)
print(max(ans))
print(*ans, sep="\n")

# Fixed code:
from collections import deque

N = int(input())
graph = [[] for _ in range(N)]

for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append([b, i])
    graph[b].append([a, i])

ans = [0] * (N - 1)
q = deque([[1, 0, -1]])
while q:
    node, pcol, p_node = q.popleft()
    cnt = 1
    for n_node in graph[node]:
        if n_node[0] == p_node: continue
        if cnt == pcol: cnt += 1
        ans[n_node[1]] = cnt
        q.append([n_node[0], cnt, node])
        cnt += 1
print(max(ans))
print(*ans, sep="\n")
# Buggy code:
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N = int(input())
    edge = [[] for _ in range(N)]
    order = dict()
    for i in range(N-1):
        a, b = map(int, input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)
        order[(min(a-1, b-1), max(a-1, b-1))] = i
    K = len(edge[0])
    for i in range(1, N): K = max(K, len(edge[i]))
    
    par = [-1] * N
    q = deque()
    col = [-1] * N
    col[0] = 0
    colE = [-1] * (N - 1)
    colPointer = 1
    for next in edge[0]: 
        q.append((0, next))
        col[next] = colPointer
        colE[order[(0, next)]] = colPointer
        colPointer += 1
    while q:
        parentNode, nowNode = q.popleft()
        par[nowNode] = parentNode
        colPointer = 1
        for nextNode in edge[nowNode]:
            if nextNode != parentNode:
                q.append((nowNode, nextNode))
                while colPointer == col[parentNode] or colPointer == col[nowNode]: colPointer += 1
                col[nextNode] = colPointer
                colE[order[(min(nowNode, nextNode), max(nowNode, nextNode))]] = colPointer
                colPointer += 1

    print(K)
    for c in colE: print(c)

    return 0

if __name__ == "__main__":
    solve()

# Fixed code:
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N = int(input())
    edge = [[] for _ in range(N)]
    order = dict()
    for i in range(N-1):
        a, b = map(int, input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)
        order[(min(a-1, b-1), max(a-1, b-1))] = i
    K = 0
    for i in range(N): K = max(K, len(edge[i]))
    
    q = deque()
    col = [-1] * N
    col[0] = 0
    colE = [-1] * (N - 1)
    colPointer = 1
    for next in edge[0]: 
        q.append((0, next))
        col[next] = colPointer
        colE[order[(0, next)]] = colPointer
        colPointer += 1
    while q:
        parentNode, nowNode = q.popleft()
        colPointer = 1
        for nextNode in edge[nowNode]:
            if nextNode != parentNode:
                q.append((nowNode, nextNode))
                if colPointer == col[nowNode]: colPointer += 1
                col[nextNode] = colPointer
                colE[order[(min(nowNode, nextNode), max(nowNode, nextNode))]] = colPointer
                colPointer += 1

    print(K)
    for c in colE: print(c)

    return 0

if __name__ == "__main__":
    solve()
# Buggy code:
from collections import deque
n=int(input())
arr=[[] for _ in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    arr[a-1].append([b-1,i])
    arr[b-1].append([a-1,i])
print(arr)

que=deque([0])
ans=[0]*(n-1)
par=[0]*n
par[0]=-1
while que:
    x=que.popleft()
    p=par[x]
    color=1
    for tup in arr[x]:
        if p==color:
            color+=1
        if ans[tup[1]]==0:
            ans[tup[1]]=color
            par[tup[0]]=color
            color+=1
            que.append(tup[0])
print(max(ans))
print(*ans,sep='\n')

# Fixed code:
from collections import deque
n=int(input())
arr=[[] for _ in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    arr[a-1].append([b-1,i])
    arr[b-1].append([a-1,i])

que=deque([0])
ans=[0]*(n-1)
par=[0]*n
par[0]=-1
while que:
    x=que.popleft()
    p=par[x]
    color=1
    for tup in arr[x]:
        if p==color:
            color+=1
        if ans[tup[1]]==0:
            ans[tup[1]]=color
            par[tup[0]]=color
            color+=1
            que.append(tup[0])
print(max(ans))
print(*ans,sep='\n')
# Buggy code:
from collections import deque


def solve(string):
    n, *ab = map(int, string.split())
    # i != j => (ai, bi) != (aj, bj)
    next_ = [dict([]) for _ in range(n + 1)]
    color = [set([]) for _ in range(n + 1)]
    queue = deque([1])
    for a, b in zip(*[iter(ab)] * 2):
        next_[a][b] = 0
        next_[b][a] = 0
    while len(queue) > 0:
        c = queue.popleft()
        _next = next_[c].items()
        use = set(range(1, len(_next) + 1)) - color[c]
        _next = (k for k, v in _next if v == 0)
        for _n, u in zip(_next, use):
            print(_n, u)
            queue.append(_n)
            next_[c][_n] = u
            next_[_n][c] = u
            color[c].add(u)
            color[_n].add(u)
    return str("{}\n{}".format(max(map(lambda x: len(x.keys()), next_)),
                               "\n".join(str(next_[a][b]) for a, b in zip(*[iter(ab)] * 2))))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


# Fixed code:
from collections import deque


def solve(string):
    n, *ab = map(int, string.split())
    # i != j => (ai, bi) != (aj, bj)
    next_ = [dict([]) for _ in range(n + 1)]
    color = [set([]) for _ in range(n + 1)]
    queue = deque([1])
    for a, b in zip(*[iter(ab)] * 2):
        next_[a][b] = 0
        next_[b][a] = 0
    while len(queue) > 0:
        c = queue.popleft()
        _next = next_[c].items()
        use = set(range(1, len(_next) + 1)) - color[c]
        _next = (k for k, v in _next if v == 0)
        for _n, u in zip(_next, use):
            queue.append(_n)
            next_[c][_n] = u
            next_[_n][c] = u
            color[c].add(u)
            color[_n].add(u)
    return str("{}\n{}".format(max(map(lambda x: len(x.keys()), next_)),
                               "\n".join(str(next_[a][b]) for a, b in zip(*[iter(ab)] * 2))))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
# Buggy code:
import math
import time
from collections import deque
from collections import defaultdict
from copy import deepcopy

t = time.time()
def iip():
    ret = [int(i) for i in input().split()]
    if len(ret) == 1:
        return ret[0]
    return ret

n = iip()
el = defaultdict(lambda :[])
for i in range(n-1):
    a, b = iip()
    el[a-1].append((b-1, i))
    el[b-1].append((a-1, i))

print(el)

def main():
    color = [None for i in range(n-1)]
    cmax = 0
    que = deque()
    que.append((0, 0))

    while que:
        parent, used_color =que.popleft()
        children = el[parent]
        cn = 1

        for child, edge_num in children:
            el[child].remove((parent, edge_num))

            if cn == used_color:
                cn += 1
            color[edge_num] = cn
            cmax = max(cn, cmax)
            cn += 1

            que.append((child, cn))

    print(cmax)
    for i in color:
        print(i)



main()

# Fixed code:
import math
import time
from collections import deque
from collections import defaultdict
from copy import deepcopy

t = time.time()
def iip():
    ret = [int(i) for i in input().split()]
    if len(ret) == 1:
        return ret[0]
    return ret

n = iip()
el = defaultdict(lambda :[])
for i in range(n-1):
    a, b = iip()
    el[a-1].append((b-1, i))
    el[b-1].append((a-1, i))

#print(el)

def main():
    color = [None for i in range(n-1)]
    cmax = 0
    que = deque()
    que.append((0, 0))

    while que:
        parent, used_color =que.popleft()
        children = el[parent]
        cn = 1

        for child, edge_num in children:
            el[child].remove((parent, edge_num))

            if cn == used_color:
                cn += 1
            color[edge_num] = cn
            cmax = max(cn, cmax)
            que.append((child, cn))
            
            cn += 1



    print(cmax)
    for i in color:
        print(i)



main()
# Buggy code:
import sys
from collections import deque
inputs = sys.stdin.readlines()

n = int(inputs[0])
edges = [tuple(map(int, x.split())) for x in inputs[1:]]
B = [e[1] for e in edges] 

E = [[] for _ in range(N + 1)]
for a, b in edges:
    E[a].append(b)

Q = deque([1])
C = [0] * (N + 1)
while Q:
    v = Q.popleft()
    c = 0
    for u in E[v]:
        c += 1 + (c + 1 == C[v])
        C[u] = c
        Q.append(u)

print(max(C))
for b in B:
    print(C[b])

# Fixed code:
import sys
from collections import deque
inputs = sys.stdin.readlines()

n = int(inputs[0])
edges = [tuple(map(int, x.split())) for x in inputs[1:]]
B = [e[1] for e in edges] 

E = [[] for _ in range(n + 1)]
for a, b in edges:
    E[a].append(b)

Q = deque([1])
C = [0] * (n + 1)
while Q:
    v = Q.popleft()
    c = 0
    for u in E[v]:
        c += 1 + (c + 1 == C[v])
        C[u] = c
        Q.append(u)

print(max(C))
for b in B:
    print(C[b])
# Buggy code:
n = int(input())
s = input()

ans = "Yes" if (n & 1) and s[0:int(n / 2)] == s[int(n / 2):n] else "No"
print(ans)


# Fixed code:
n = int(input())
s = input()

ans = "Yes" if (n ^ 1) and s[0:int(n / 2)] == s[int(n / 2):n] else "No"
print(ans)
# Buggy code:
import sys

N = int(input())
str_input = input()

if N % 2 != 0:
  print('No')
else:
  print('Yes') if str_input[:N/2] == str_input[:N] else print('No')


# Fixed code:
N = int(input())
str_input = input()
 
if N % 2 != 0:
  print('No')
else:
  print('Yes') if str_input[:N//2] == str_input[(N//2):] else print('No')
# Buggy code:
n=int(input())
li=list(input())
if n%2==0:
  t=int(n/2)
  print(t)
  a=li[:t]
  t=t-1
  b=li[:-t-1]
  if a==b:
    print('Yes')
  else:
    print('No')
else:
  print('No')

# Fixed code:
n=int(input())
li=list(input())
if n%2==0:
  t=int(n/2)
  a=li[:t]
  b=li[-t:]
  if a==b:
    print('Yes')
  else:
    print('No')
else:
  print('No')
# Buggy code:
n = int(input())
s = input()
a = (len(s)//2)
count = 0
if len(s) == n:
  for i in range (len(s)//2):
    if s[i] == s[a + i]:
      count += 1
  if count == n//2:
    print('Yes')
  else:
    print('No')
else: 
  print('No')


# Fixed code:
n = int(input())
s = input()
a = (len(s)//2)
count = 0
if n % 2 == 0:
  for i in range (a):
    if s[i] == s[a + i]:
      count += 1
  if count == n/2:
    print('Yes')
  else:
    print('No')
else: 
  print('No')
# Buggy code:
N = int(input())
S = input()
if N%2==1:
    print('No')
else:
    for i in range(N//2):
        S1 += S[i]
    for j in range(N//2,N):
        S2 += S[j]
    if S1==S2:
        print('Yes')
    else:
        print('No')

# Fixed code:
N = int(input())
S = input()
S1 = ''
S2 = ''
if N%2==1:
    print('No')
else:
    for i in range(N//2):
        S1 += S[i]
    for j in range(N//2,N):
        S2 += S[j]
    if S1==S2:
        print('Yes')
    else:
        print('No')
# Buggy code:
# coding: utf-8
n = int(input())
s = input()
if n % 2:
	print('No')
else:
	if s[0:(n/2)] == s[(n/2):n]:
		print('Yes')
	else:
		print('No')

# Fixed code:
# coding: utf-8
n = int(input())
s = input()
if n % 2:
	print('No')
else:
	if s[0:int(n/2)] == s[int(n/2):n]:
		print('Yes')
	else:
		print('No')
# Buggy code:
N = int(input())
list = list(input())
n = 0
if N % 2 != 0:
	print("No")
else:
    for i in range(N//2):
	    if not list[i] == list[i+ N//2]:
            print("No")
            break
        n += 1
    if n == N//2 - 1:
        print("Yes")


# Fixed code:
N = int(input())
list = list(input())
n = 0
if N % 2 != 0:
	print("No")
else:
    for i in range(N//2):
        if not list[i] == list[i+ N//2]:
            print("No")
            break
        n += 1
    if n == N//2:
        print("Yes")
# Buggy code:
N=int(input())
S=input()
if N%2==1:
    print("No")
if S[:N//2]==S[N//2:]:
    print("Yes")
else:
    print("No")
    

# Fixed code:
N = int(input())
S = input()

if N%2==1:
    print('No')
else:
    N2 = N//2
    if S[:N2]==S[N2:]:
        print('Yes')
    else:
        print('No')
# Buggy code:
import re
a = [input() for i in range(2)]
length, string = int(a[0]), a[1]
pattern = string[0:int(length/2)]
cond1 = len(string) == length
cond2 = re.match(r"^[a-z]+$", string)
cond3 = len(re.findall(pattern, string)) == 2
if cond1 and cond2 and cond3:
  print("Yes")
else:
  print('No')

# Fixed code:
import re
a = [input() for i in range(2)]
length, string = int(a[0]), a[1]
pattern = string[0:int(length/2)]
cond1 = len(string) == length and len(string)%2==0
cond2 = re.match(r"^[a-z]+$", string)
cond3 = len(re.findall(pattern, string)) == 2
if cond1 and cond2 and cond3:
  print("Yes")
else:
  print('No')
# Buggy code:
n = int(input())
s = input()
if(n % 2 == 0):
  print(s[0:n // 2], s[n // 2: n])
  if(s[0:n // 2] == s[n // 2: n]):
    print("Yes")
    exit()
print("No")

# Fixed code:
n = int(input())
s = input()
if(n % 2 == 0):
  if(s[0:n // 2] == s[n // 2: n]):
    print("Yes")
    exit()
print("No")
# Buggy code:
import sys
N = int(input())
s = input()
if N%2 != 1:
  print('No')
  sys.exit()
if s[:N//2] == s[N//2+1:]:
  print('Yes')
else:
  print('No')

# Fixed code:
import sys
N = int(input())
s = input()
if N%2 ==1:
  print('No')
  sys.exit()
if s[:N//2] == s[N//2:]:
  print('Yes')
else:
  print('No')
# Buggy code:
n = int(input())
s = input()

print(s[0:int(n/2)], s[int(n/2):n])

if s[0:int(n/2)] == s[int(n/2):n]:
    print("Yes")
else: print("No")


# Fixed code:
n = int(input())
s = input()

if s[0:int(n/2)] == s[int(n/2):n]:
    print("Yes")
else: print("No")
# Buggy code:
n=int(input())
s=list(str(input()))
if n%2==1:
  print("No")
else:
  for i in range(int(n/2)):
    if s[i]!=s[i+int(n/2)]:
      print("No")
  print("Yes")

# Fixed code:
import sys
n=int(input())
s=list(str(input()))
if n%2==1:
  print("No")
else:
  for i in range(int(n/2)):
    if s[i]!=s[i+int(n/2)]:
      print("No")
      exit()
  print("Yes")
# Buggy code:
N = int(input())
S = str(input())

if N%2 == 1:
    print('No')
    exit()

n = (N/2)
j = True


for i in range(n):
    if S[i] != S[i + n]:
        j = False

if j:
    print('Yes')
else:
    print('No')


# Fixed code:
import math
N = int(input())
S = str(input())

if N == 1:
    print('No')
    exit()
if N%2 == 1:
    print('No')
    exit()

n = (N//2)
j = True


for i in range(n):
    if S[i] != S[i + n]:
        j = False

if j:
    print('Yes')
else:
    print('No')
# Buggy code:
# -*- coding utf-8 -*-

MOD = 10 ** 9 + 7

n = int(input())
s = input()
print(s[:n//2], s[n//2:])

if n % 2 ==0:
    ans = 'Yes' if s[:n//2] == s[n//2:] else 'No'
else:
    ans = 'No'

print(ans)



# Fixed code:
# -*- coding utf-8 -*-

MOD = 10 ** 9 + 7

n = int(input())
s = input()

if n % 2 ==0:
    ans = 'Yes' if s[:n//2] == s[n//2:] else 'No'
else:
    ans = 'No'

print(ans)
# Buggy code:
n=int(input())
s=input()
import sys
a=0
sys.exit()
if n==1:
    print('No')
    sys.exit()
if n%2!=0:
    print('No')
    sys.exit()
else:
    for i in range(n//2):
        if s[i]==s[i+(n//2)]:
            pass
        else:
            a=1
            break
if a==0:
    print('Yes') 
else:
    print('No')       

# Fixed code:
n=int(input())
s=input()
import sys
a=0
if n==1:
    print('No')
    sys.exit()
if n%2!=0:
    print('No')
    sys.exit()
else:
    for i in range(n//2):
        if s[i]==s[i+(n//2)]:
            pass
        else:
            a=1
            break
if a==0:
    print('Yes') 
else:
    print('No')
# Buggy code:
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
s = input()

if n %2 == 0:
    print('No')
else:
    flag = True
    for i in range(n):
        if s[i] != s[n//2 + i]:
            flag = False
    if flag:
        print('Yes')
    else:
        print('No')

# Fixed code:
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
s = input()

if n%2 == 1:
    print('No')
else:
    flag = True
    for i in range(n//2):
        if s[i] != s[n//2 + i]:
            flag = False
    if flag:
        print('Yes')
    else:
        print('No')
# Buggy code:
n=int(input())
s=input()
print('Yes'if s[:len(s)//2]==s[len(s)//2:] else 'No')
print(s[:len(s)//2], s[len(s)//2:])


# Fixed code:
n=int(input())
s=input()
print('Yes'if s[:len(s)//2]==s[len(s)//2:] else 'No')
# Buggy code:
N = int(input())
S = str(input())
S = list(S)

if N%2 != 0:
    print('No')
    exit()

S1, S2 = [], []
for i, s enumerate(S):
    if i < (N/2):
        s1.append(s)
    else:
        s2.append(s)

s1, s2 = ' ', ' '
for s in S1:
    s1 += s

for s in S2:
    s2 += s

if s1 ==s2:
    print('Yes')
else:
    print('No')


# Fixed code:
N = int(input())
S = str(input())
S = list(S)

if N%2 != 0:
    print('No')
    exit()

S1, S2 = [], []
for i, s in enumerate(S):
    if i < (N/2):
        S1.append(s)
    else:
        S2.append(s)

s1 = ' '
for s in S1:
    s1 += s

s2 = ' '
for s in S2:
    s2 += s

if s1 == s2:
    print('Yes')
else:
    print('No')
# Buggy code:
N=input()
S=list(input())

if len(N)%2!=0:
  print('No')
else:
  if S[:N/2]==S[N/2]:
    print('Yes')
  else:
    print('No')

# Fixed code:
N=int(input())
S=list(input())
 
if N%2!=0:
    print('No')
else:
    if S[:N//2]==S[N//2:]:
        print('Yes')
    else:
        print('No')
# Buggy code:
a=int(input())
S=input()
if a%2 != 0:
  print("No")
else:
  b=0
  while	b<=a//2-1:
        S[b]==S[a//2+b]
        b=b+1
  if b==a//2:
    print("Yes")
  else:
    print("No")

# Fixed code:
a=int(input())
S=input()
if a%2 != 0:
  print("No")
else:
  b=0
  while	b<=a//2-1 and 0<=b:
        if S[b]==S[a//2+b]:
          b=b+1
        else:
          b=-1
  if b==a//2:
    print("Yes")
  else:
    print("No")
# Buggy code:
n = int(input())
s = input()

if n % 2 != 0:
    print('No')
else:
    t = s[0:int(n / 2)]
    if t * 2 == s:
        print('Yes')
    else:
        print('No')
 =


# Fixed code:
n = int(input())
s = input()

if n % 2 != 0:
    print('No')
else:
    t = s[0:int(n / 2)]
    if t * 2 == s:
        print('Yes')
    else:
        print('No')
# Buggy code:
r = int(input())
s = input()

i = int(r/2)
before = s[i:]
after = s[:i]

if before == after:
	print('Yes')
else:
  	print('no')


# Fixed code:
r = int(input())
s = input()
 
i = int(r/2)
before = s[i:]
after = s[:i]
 
if before == after:
	print('Yes')
else:
  	print('No')
# Buggy code:
N = int(input())
S = str(input())
n = 0
A = []
B = []
if N % 2 == 0:
  n = int(N / 2)
  for i in range(0, n):
    A.append(S[i])
    B.append(S[n+i])

if A == B:
  print('Yes')
else:
  print('No')

# Fixed code:
N = int(input())
S = str(input())
n = 0
A = []
B = []
if N % 2 == 0:
  n = int(N / 2)
  for i in range(0, n):
    A.append(S[i])
    B.append(S[n+i])

if A == B and N % 2 == 0:
    print('Yes')
else:
  print('No')
# Buggy code:
# coding: utf-8
N=int(input())
S=input()
if S[:N/2]==S[N/2:]: print("Yes")
else: print("No")

# Fixed code:
# -*- coding: utf-8 -*-

N = int(input())
S = input()

if S[:N//2] == S[N//2:]:
    print('Yes')
else:
    print('No')
# Buggy code:
def main():
    N = int(input())
    S = input()
    if N % 2 == 1:
        print("No")
        quit()
    yesno = "Yes" if S[:N / 2] == S[N / 2:] else "No"
    print(yesno)


if __name__ == "__main__":
    main()


# Fixed code:
def main():
    N = int(input())
    S = input()
    if N % 2 == 1:
        print("No")
        quit()
    n = N // 2
    yesno = "Yes" if S[:n] == S[n:] else "No"
    print(yesno)


if __name__ == "__main__":
    main()
# Buggy code:
N = int(input())
S = input()
l = len(S)
flg = 0
if l%2 == 0:
	flg = 1
	print("No")
else:
	for i in range(l/2):
		if S[i] != S[i+l/2]:	
			print("No")
			flg = 1
            break
if flg == 0:
	print("Yes")

# Fixed code:
N = int(input())
S = input()
l = len(S)
flg = 0
if l%2 == 1:
	flg = 1
	print("No")
else:
	for i in range(int(l/2)):
		if S[i] != S[i+int(l/2)]:	
			print("No")
			flg = 1
			break
if flg == 0:
	print("Yes")
# Buggy code:
len = int(input())
s = input()
s1 = s[:len / 2]
s2 = s[len/2:]
if s1 == s2:
  print('Yes')
else:
  print('No')

# Fixed code:
l = int(input())
s = input()
s1 = s[:l // 2]
s2 = s[l//2:]
if s1 == s2:
    print('Yes')
else:
    print('No')
# Buggy code:
N = int(input())
S = input()

if N % 2 != 0:
    print("No")
else:
    a = S[0;N/2]
    b = S[N/2;]
    if a == b:
        print("Yes")
    else:
        print("No")

# Fixed code:
N = int(input())
S = input()

if N % 2 != 0:
    print("No")
else:
    a = S[:N//2]
    b = S[N//2:]
    if a == b:
        print("Yes")
    else:
        print("No")
# Buggy code:
n=int(input())
s=input()
if n%2==0:
  s1=s[:n/2]
  s2=s[n/2:]
  if s1==s2:
    print("Yes")
  else:
    print("No")
else:
  print("No")

# Fixed code:
n=int(input())
s=input()
if n%2==0:
  i=int(n/2)
  s1=s[:i]
  s2=s[i:]
  if s1==s2:
    print("Yes")
  else:
    print("No")
else:
  print("No")