CodeEff/ECCO huggingface dataset:
# Original solution
n,m=list(map(int,input().split()))
x=[0]*n
for i in range(m):
  a,b=list(map(int,input().split()))
  x[a-1]+=1
  x[b-1]+=1
ans="YES"
for i in range(n):
  if x[i]%2:ans="NO"
print(ans)

# Optimized solution
n,m=list(map(int,input().split()))
ans=[0]*n
for i in range(m):
  a,b=list(map(int,input().split()))
  ans[a-1]^=1
  ans[b-1]^=1
if 1 not in ans:print('YES')
else:print('NO')
# Original solution
N, M = list(map(int, input().split()))

lst = [0] * (N + 1)

for _ in range(M):
    a, b = list(map(int, input().split()))
    lst[a] += 1
    lst[b] += 1

for i in lst:
    if i % 2 == 1:
        print ('NO')
        exit()

print ('YES')

# Optimized solution
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))

lst = [0] * (N + 1)

for _ in range(M):
    a, b = list(map(int, input().split()))
    lst[a] += 1
    lst[b] += 1

for i in lst:
    if i % 2 == 1:
        print ('NO')
        exit()

print ('YES')
# Original solution
def main():
    import sys
    input = sys.stdin.buffer.readline
    N, M = (int(i) for i in input().split())
    G = [[] for i in range(N)]
    for i in range(M):
        x, y = (int(i)-1 for i in input().split())
        G[x].append(y)
        G[y].append(x)

    for i in range(N):
        if len(G[i]) % 2:
            return print("NO")
    else:
        return print("YES")


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    import sys
    input = sys.stdin.buffer.readline
    N, M = (int(i) for i in input().split())
    cnt = [0]*N
    AB = [[int(i)-1 for i in input().split()] for j in range(M)]
    for a, b in AB:
        cnt[a] += 1
        cnt[b] += 1
    if all(c % 2 == 0 for c in cnt):
        print("YES")
    else:
        print("NO")


if __name__ == '__main__':
    main()
# Original solution
from collections import Counter
N, M = list(map(int, input().split()))
print(("YES" if all(x % 2 == 0 for x in list(Counter(sum([list(map(int, input().split())) for _ in range(M)], [])).values())) else "NO"))


# Optimized solution
from collections import Counter
N, M = list(map(int, input().split()))
cnt = Counter()
for _ in range(M):
    a, b = list(map(int, input().split()))
    cnt[a] += 1
    cnt[b] += 1
print(("YES" if all(x % 2 == 0 for x in list(cnt.values())) else "NO"))
# Original solution
import sys

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

    ncnt = [0]*N

    for i in range(M):
        a, b = list(map(int, sys.stdin.readline().split()))
        a -= 1
        b -= 1

        ncnt[a] += 1
        ncnt[b] += 1

    if all(ni & 1 == 0 for ni in ncnt):
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    solve()

# Optimized solution
import sys

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

    ncnt = [0]*N

    for i in range(M):
        a, b = list(map(int, sys.stdin.readline().split()))
        a, b = a-1, b-1

        ncnt[a] ^= 1
        ncnt[b] ^= 1

    print(('NO' if any(ni for ni in ncnt) else 'YES'))

if __name__ == '__main__':
    solve()
# Original solution
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


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


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, AB):
    c = Counter(reduce(add, AB))
    for v in c.values():
        if v % 2 != 0:
            return 'NO'
    return 'YES'


def main():
    N, M = read_int_n()
    AB = [read_int_n() for _ in range(M)]
    print(slv(N, M, AB))


if __name__ == '__main__':
    main()


# Optimized solution
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


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


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, AB):
    c = Counter()
    for a, b in AB:
        c[a] += 1
        c[b] += 1
    for v in c.values():
        if v % 2 != 0:
            return 'NO'
    return 'YES'


def main():
    N, M = read_int_n()
    AB = [read_int_n() for _ in range(M)]
    print(slv(N, M, AB))


if __name__ == '__main__':
    main()
# Original solution
from collections import Counter

N, M = list(map(int, input().split()))
counter = Counter()
for i in range(M):
    a, b = list(map(int, input().split()))
    counter[a] += 1
    counter[b] += 1

if all(x % 2 == 0 for x in list(counter.values())):
    print("YES")
else:
    print("NO")


# Optimized solution
n,m,*p=list(map(int,open(0).read().split()));c=[0]*n
for x in p:c[x-1]+=1
print(("YNEOS"[any(x%2for x in c)::2]))
# Original solution
#AGC014-B Unplanned Queries
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,m = list(map(int,readline().split()))
dic1 = defaultdict(int)
for i in range(m):
    a,b = list(map(int,readline().split()))
    dic1[a] += 1
    dic1[b] += 1

for i in list(dic1.values()):
    if not even(i):
        print("NO")
        exit()
print("YES")

# Optimized solution
#AGC014-B Unplanned Queries
"""
今回は各辺の偶奇のみを考えるので、
根付き木を考えた時に、頂点a,bから親側に全部流した時に、
LCAより先は勝手に偶数になるので無視できる。
とした場合に、根をrootとして、各クエリに対して
a-root,b-rootへのパスに1を足すことと考えると、
結局各辺の偶奇はaとbの出現回数の偶奇によると考える事ができる。
よって、クエリに与えられる辺の回数をdictで保持し、
最終的に一つでも奇数回出現する頂点があるならばFalse
そうでないならTrueとなる

"""
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,m = list(map(int,readline().split()))
dic1 = defaultdict(int)
for i in range(m):
    a,b = list(map(int,readline().split()))
    dic1[a] += 1
    dic1[b] += 1

for i in list(dic1.values()):
    if not even(i):
        print("NO")
        exit()
print("YES")
# Original solution
N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(M)]

count = [0 for i in range(N)]

for aibi in ab:
    ai = aibi[0]
    bi = aibi[1]

    if bi < ai:
        tmp = ai
        ai = bi
        bi = tmp

    for j in range(ai - 1, bi - 1):
        count[j] += 1

yes_or_no = True
for num in count:
    if num % 2 == 1:
        yes_or_no = False

if yes_or_no:
    print("YES")
else:
    print("NO")


# Optimized solution
N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(M)]

count = [0 for i in range(N)]

# for aibi in ab:
#     ai = aibi[0]
#     bi = aibi[1]
#
#     if bi < ai:
#         tmp = ai
#         ai = bi
#         bi = tmp
#
#     for j in range(ai - 1, bi - 1):
#         count[j] += 1

for aibi in ab:
    ai = aibi[0]
    bi = aibi[1]
    if ai != 1 and bi != 1:
        count[ai - 1] += 1
        count[bi - 1] += 1
    else:
        if ai == 1:
            count[bi - 1] += 1
        else:
            count[ai - 1] += 1

yes_or_no = True
for num in count:
    if num % 2 == 1:
        yes_or_no = False

if yes_or_no:
    print("YES")
else:
    print("NO")
# Original solution
n,m=list(map(int,input().split()))
a=[0]*n
for i in range(m):
	u,v=list(map(int,input().split()))
	a[u-1]^=1
	a[v-1]^=1
if sum(a):
	print("NO")
else:
	print("YES")

# Optimized solution
n,m=list(map(int,input().split()))
t=0
for i in range(m):
	u,v=list(map(int,input().split()))
	t^=u^v
print(("NO" if t else "YES"))
# Original solution
n,m = list(map(int,input().split()))
edge = [0] * (n-1)
for i in range(m):
    a,b = list(map(int,input().split()))
    if a > b:
        a,b = b,a
    for j in range(a,b):
        edge[j-1] += 1
for i in range(len(edge)):
    if edge[i] % 2 == 1:
        print("NO")
        exit()
print("YES")




# Optimized solution
n,m = list(map(int,input().split()))
point = [0] * n
cnt = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    point[a-1] += 1
    point[b-1] += 1
    # if a > b:
    #     a,b = b,a
    # for j in range(a,b):
    #     edge[j-1] += 1
for i in range(len(point)):
    if point[i] % 2 == 1:
        print("NO")
        exit()
print("YES")
# Original solution
from collections import Counter

N, M, *AB = list(map(int, open(0).read().split()))
C = Counter(AB)
if all(c % 2 == 0 for c in list(C.values())):
    print("YES")
else:
    print("NO")


# Optimized solution
from collections import Counter

N, M, *AB = list(map(int, open(0).read().split()))

C = Counter(AB)
if any(c % 2 == 1 for c in list(C.values())):
    print("NO")
else:
    print("YES")
# Original solution
N, M = list(map(int, input().split()))
Path = [0 for i in range(N)]
for _ in range(M):
    a, b = list(map(int, input().split()))
    a, b = min(a, b), max(a, b)
    Path[b-1] += 1
    if a > 1:
        Path[a-1] += 1

for p in Path:
    if p % 2 != 0:
        print("NO")
        break
else: print("YES")

# Optimized solution
import sys
def solve():
    input = sys.stdin.readline
    N, M = list(map(int, input().split()))
    count = [0] * N
    for _ in range(M):
        a, b = list(map(int, input().split()))
        a, b = min(a, b), max(a, b)
        if a > 1: count[a-1] += 1
        count[b-1] += 1
    
    for i, a in enumerate(count):
        if a % 2 > 0: 
            print("NO")
            break
    else: print("YES")

    return 0

if __name__ == "__main__":
    solve()
# Original solution
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

n,m = li()

cnt = Counter([])
for _ in range(m):
    cnt += Counter(li())
    
exist = True
for v in list(cnt.values()):
    if v%2:
        exist = False
        break

if exist:
    print("YES")
else:
    print("NO")

# Optimized solution
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,m = li()

cnt = [0]*n
for _ in range(m):
    a,b = li_()
    cnt[a] += 1
    cnt[b] += 1
    
exist = True
for c in cnt:
    if c%2:
        exist = False
        break

if exist:
    print("YES")
else:
    print("NO")
# Original solution
N,M = list(map(int,input().split()))
k = 0
while True:
    if 2**k>=N:
        break
    k += 1
A = [0 for i in range(2**k+1)]
for _ in range(M):
    a,b = list(map(int,input().split()))
    if b<a:
        a,b = b,a
    A[a] += 1
    A[b] -= 1
B = [0 for i in range(2**k+2)]
for i in range(2**k+1):
    B[i+1] = B[i]+A[i]
flag = 0
for i in range(2**k+1):
    if B[i]%2==1:
        flag = 1
        break
if flag==0:
    print("YES")
else:
    print("NO")

# Optimized solution
N,M = list(map(int,input().split()))
C = {i:0 for i in range(1,N+1)}
for _ in range(M):
    a,b = list(map(int,input().split()))
    C[a] = (C[a]+1)%2
    C[b] = (C[b]+1)%2
flag = 0
for i in range(1,N+1):
    if C[i]==1:
        flag = 1
        break
if flag==0:
    print("YES")
else:
    print("NO")
# Original solution
import sys
# 整数の入力
N,M=list(map(int, input().split()))
p=[]
q=0
count=[]
for i in range(0,M):
  p.append(list(map(int, input().split())))
  count.append(0)
for i in range(0,M):
  q+=p[i][0]-p[i][1]
if q%2==1:
  print("NO")
else:
  for j in range(0,M):
    for i in range(0,M):
      if p[i][0]==j or p[i][1]==j:
        count[j]+=1
  for j in range(0,M):
    if count[j]%2==1:
      print("NO")
      sys.exit()
  print("YES")

# Optimized solution
import sys
# 整数の入力
N,M=list(map(int, input().split()))
p=[]
for i in range(0,N):
  p.append(0)
for i in range(0,M):
  count=list(map(int, input().split()))
  p[count[0]-1]+=1
  p[count[1]-1]+=1
for i in range(0,M):
  if p[i]%2==1:
    print("NO")
    sys.exit()
print("YES")
# Original solution
from collections import Counter
n,m=list(map(int,input().split()))
l=[]
for _ in range(m):
  a,b=list(map(int,input().split()))
  if a>b:a,b=b,a
  l.extend([(i,i+1) for i in range(a,b)])
c=Counter(l)
*v,=[x for x in list(c.values()) if x%2]
if v:
  print("NO")
else:
  print("YES")

# Optimized solution
from itertools import accumulate as ac
n,m=list(map(int,input().split()))
l=[0]*(n+1)
for _ in range(m):
  a,b=list(map(int,input().split()))
  if a>b:a,b=b,a
  l[a]+=1
  l[b]-=1

*l,=ac(l)
*l,=[x for x in l if x%2]
if l:
  print("NO")
else:
  print("YES")
# Original solution
import sys,math,collections,itertools
input = sys.stdin.readline

N,M=list(map(int,input().split()))
road = [0]*(N-1)
for _ in range(M):
    l,r=list(map(int,input().split()))
    for i in range(l-1,r-1):
        road[i]+=1
if sum(road)%2==0:
    print('YES')
else:
    print('NO')


# Optimized solution
import sys,math,collections,itertools
input = sys.stdin.readline

N,M=list(map(int,input().split()))
road = [0]*(N)
for _ in range(M):
    l,r=list(map(int,input().split()))
    road[l-1]+=1
    road[r-1]-=1
road = list(itertools.accumulate(road))[:-1]

flag=0
for ro in road:
    if ro%2==1:
        print('NO')
        exit()
print('YES')
# Original solution
l=[0]*2**17
for i in open(0).read().split()[2:]:l[int(i)]+=1
print(('YNEOS'[any(i%2for i in l)::2]))

# Optimized solution
from collections import*;print(('YNEOS'[any(i%2for i in list(Counter(open(0).read().split()[2:]).values()))::2]))
# Original solution
n,m=list(map(int,input().split()))
lists=[0 for i in range(m)]
for i in range(m):
    x,y=list(map(int,input().split()))
    lists[i]=(x,y)
anslist=[0 for i in range(n+1)]
#anslist[1] からanslist[n]まででこれらが全て偶数となるような時を考えればいい
#そうでないならばそれはNoである
for j in lists:
    if j[0]==1:
        anslist[j[1]]+=1
        
    elif j[1]==1:
        anslist[j[0]]+=1
        
    else:
        x=j[0]
        y=j[1]
        anslist[x]+=1
        anslist[y]+=1
flag=True
for k in anslist:
    if k%2!=0:
        flag=False
        break
if flag:
    print("YES")
else:
    print("NO")

# Optimized solution
n,m=list(map(int,input().split()))
lists=[0 for i in range(n)]
for i in range(m):
    a,b=list(map(int,input().split()))
    lists[a-1]+=1
    lists[b-1]+=1
flag=True
for i in range(n):
    if lists[i]%2!=0:
        flag=False
        break
if flag:
    print("YES")
else:
    print("NO")
# Original solution
import collections
N, M = list(map(int, input().split()))
a = [0]*M
b = [0]*M
for i in range(M):
    a[i], b[i] = list(map(int, input().split()))
table = collections.defaultdict(int)

for i in range(M):
    table[a[i]] += 1
    table[b[i]] += 1

odd = []
for x in table:
    if table[x] % 2 == 1:
        odd.append(x)

if len(odd) > 0:
    print("NO")
else:
    print("YES")


# Optimized solution
N,M=list(map(int,input().split()))
import collections
table=collections.defaultdict(int)
for i in range(M):
  a,b=list(map(int,input().split()))
  table[a]+=1
  table[b]+=1
flag=True
for x in table:
  if table[x]%2==1:
    flag = False
    break
if flag:
  print("YES")
else:
  print("NO")
# Original solution
from collections import defaultdict
n,m=list(map(int,input().split()))
ab=[list(map(int,input().split())) for i in range(m)]
cnt=defaultdict(lambda :0)

for i in range(m):
    for j in range(2):
        cnt[ab[i][j]]+=1

for i in list(cnt.values()):
    if i%2!=0:
        print('NO')
        exit()
print('YES')

# Optimized solution
from collections import defaultdict
n,m=list(map(int,input().split()))
ab=[list(map(int,input().split())) for i in range(m)]
cnt=defaultdict(lambda :0)
for i in range(m):
    cnt[ab[i][0]]+=1
    cnt[ab[i][1]]+=1

for i in list(cnt.values()):
    if i%2!=0:
        print('NO')
        exit()
print('YES')
# Original solution
from itertools import accumulate

N, M = map(int, input().split())
acc = [0] * N
for _ in range(M):
    a, b = map(int, input().split())
    if a > b:
        a, b = b, a
    acc[a - 1] += 1
    acc[b - 1] -= 1
print("NO") if any(a % 2 for a in accumulate(acc)) else print("YES")


# Optimized solution
from itertools import accumulate

N, M, *ab = map(int, open(0).read().split())
acc = [0] * (N + 1)
for a, b in zip(*[iter(ab)] * 2):
    if a > b:
        a, b = b, a
    acc[a - 1] += 1
    acc[b - 1] -= 1
acc = list(accumulate(acc, initial=0))
print("NO") if any(a % 2 for a in acc) else print("YES")
# Original solution
from itertools import accumulate

N, M, *ab = map(int, open(0).read().split())
acc = [0] * (N + 1)
for a, b in zip(*[iter(ab)] * 2):
    if a > b:
        a, b = b, a
    acc[a - 1] += 1
    acc[b - 1] -= 1
acc = list(accumulate(acc, initial=0))
print("NO") if any(a % 2 for a in acc) else print("YES")


# Optimized solution
N, M, *ab = map(int, open(0).read().split())
ans = [0] * N
for a, b in zip(*[iter(ab)] * 2):
    ans[a - 1] += 1
    ans[b - 1] -= 1
print("NO") if any(a % 2 for a in ans) else print("YES")
# Original solution
n,m=list(map(int,input().split()))
c=sum([list(map(int,input().split())) for i in range(m)],[])
from collections import Counter as co
for i in list(co(c).values()):
    if i%2:print("NO");exit()
print("YES")

# Optimized solution
n,m=list(map(int,input().split()))
l=[0]*(n+1)
for i in range(m):
    a,s=list(map(int,input().split()))
    l[a]+=1
    l[s]+=1
for i in l:
    if i%2:print("NO");exit()
print("YES")
# Original solution
# すべての頂点が入力に現れる回数が偶数であればOK 奇数回の頂点が一つでもあればNO
from collections import defaultdict as d

N,M = list(map(int,input().split()))
E = d(int)

for i in range(M):
  a,b = list(map(int,input().split()))
  E[a] ^= 1
  E[b] ^= 1

print((("YES","NO")[sorted(E.values())[-1]]))


# Optimized solution
from collections import defaultdict as d
N,M=list(map(int,input().split()))
E=d(int)
for i in range(M):
  a,b=list(map(int,input().split()))
  E[a]^=1
  E[b]^=1
print((("YES","NO")[max(E.values())]))
# Original solution
from collections import Counter

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

cnt = Counter()
for q in Q:
    cnt += Counter(q)

for k in cnt:
    if cnt[k] % 2 != 0:
        print("NO")
        exit()
print("YES")


# Optimized solution
N, M = list(map(int, input().split()))
Q = [list(map(int, input().split())) for _ in range(M)]

cnt = [0 for _ in range(N)]
for a, b in Q:
    cnt[a-1] += 1
    cnt[b-1] += 1

for k in range(N):
    if cnt[k] % 2 != 0:
        print("NO")
        exit()
print("YES")
# Original solution
def solve():
  n,m = (int(i) for i in input().split())
  a = []
  b = []
  for i in range(m):
    a1,b1 = (int(i) for i in input().split())
    a.append(a1)
    b.append(b1)
  ans = 'YES'
  for i in range(1,n+1):
   if (a.count(i)+b.count(i))%2 == 1:
    ans ='NO'
  return ans
                   
  
if __name__ == '__main__':
  print((solve()))

# Optimized solution
def solve():
  n,m = (int(i) for i in input().split())
  a = [0]*n
  for i in range(m):
    a1,b1 = (int(i) for i in input().split())
    a[a1-1]+=1
    a[b1-1]+=1
  ans = 'YES'
  for i in range(n):
   if a[i]%2 == 1:
    ans ='NO'
  return ans
                   
  
if __name__ == '__main__':
  print((solve()))
# Original solution
N, M = list(map(int, input().split()))
# 木だったらなんでもOK?
# いもす法

edge = [0] * (N + 1)
for _ in range(M):
    a, b = list(map(int, input().split()))
    edge[a] += 1
    edge[b] -= 1

ans = "YES"
for i in range(N):
    edge[i + 1] += edge[i]
    if edge[i + 1] % 2 == 1:
        ans = "NO"
        break

print(ans)


# Optimized solution
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, M = list(map(int, input().split()))
cnt = [0] * (N + 1)
for _ in range(M):
    a, b = list(map(int, input().split()))
    cnt[a] ^= 1
    cnt[b] ^= 1

if all(x == 0 for x in cnt):
    print("YES")
else:
    print("NO")
# Original solution
#!/usr/bin/env python3
import sys


def solve(s: str, K: int):

    index_dict = {}
    for i in range(len(s)):
        if index_dict.get(s[i]) == None:
            index_dict[s[i]] = [i]
        else:
            index_dict[s[i]].append(i)

    value_list = sorted(set(list(s)))
    candidate = set()
    for string in value_list:
        index = index_dict[string]
        for i in index:
            tmp_s = ""
            for j in range(i,len(s)):
                tmp_s += s[j]
                candidate.add(tmp_s)
        if len(candidate) >= K:
            break
    candidate = list(candidate)
    candidate.sort()
    print((candidate[K-1]))

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    K = int(next(tokens))  # type: int
    solve(s, K)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys


def solve(s: str, K: int):

    index_dict = {}
    for i in range(len(s)):
        if index_dict.get(s[i]) == None:
            index_dict[s[i]] = [i]
        else:
            index_dict[s[i]].append(i)

    value_list = sorted(set(list(s)))
    candidate = set()

    for string in value_list:
        index = index_dict[string]
        for i in index:
            tmp_s = ""
            for j in range(i,len(s)):
                if len(tmp_s) > K:
                    break
                tmp_s += s[j]
                candidate.add(tmp_s)
        if len(candidate) >= K:
            break
    candidate = list(candidate)
    candidate.sort()
    print((candidate[K-1]))

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    K = int(next(tokens))  # type: int
    solve(s, K)

if __name__ == '__main__':
    main()
# Original solution
s = input()
k = int(input())
l = len(s)
ls = []
for a in range(l):
    for b in range(a+1,l+1):
        if ls.count(s[a:b]) == 0:
            ls.append(s[a:b])
ls.sort()
print(ls[k-1])

# Optimized solution
s = input()
k = int(input())
l = len(s)
ls = []
for a in range(l):
    for b in range(a+1,min(a+k+1,l+1)):
        if ls.count(s[a:b]) == 0:
            ls.append(s[a:b])
ls.sort()
print(ls[k-1])