<reponame>ATrain951/01.python-com_Qproject<gh_stars>1-10
"""
# Sample code to perform I/O:

name = input()                  # Reading input from STDIN
print('Hi, %s.' % name)         # Writing output to STDOUT

# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""

# Write your code here
n = int(input())
s = input().strip()
substring = ''
for i in range(n):
    substring = max(substring, s[i:])
print(substring)

"""
# Sample code to perform I/O:

name = input()                  # Reading input from STDIN
print('Hi, %s.' % name)         # Writing output to STDOUT

# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""

# Write your code here
n = int(input())
s = input().strip()
substring = ''
for i in range(n):
    substring = max(substring, s[i:])
print(substring)
# Sample code to perform I/O:  name = input()                  # Reading input from STDIN print('Hi, %s.' % name)         # Writing output to STDOUT  # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail # Write your code here