text = open("output.txt",'r').read().decode('hex')
freq = sorted(set(text), key = text.count)[::-1]

# Spaces are most frequent
englishLetterFreq = ' ERNIOSALTHGCUMWBDYPFVKJXQZ'
# Map each ciphertext with a letter
mapping = {}
for i,t in enumerate(freq):
	if i < 27:
		mapping[t] = englishLetterFreq[i]

flag = ''
for c in text:
	if c in mapping.keys():
		flag += mapping[c]

print(flag)
71149d250c24e62c50006fd38d77323ac610b305
<mask token>

<mask token>
for i, t in enumerate(freq):
    if i < 27:
        mapping[t] = englishLetterFreq[i]
<mask token>
for c in text:
    if c in mapping.keys():
        flag += mapping[c]
print(flag)

text = open('output.txt', 'r').read().decode('hex')
freq = sorted(set(text), key=text.count)[::-1]
englishLetterFreq = ' ERNIOSALTHGCUMWBDYPFVKJXQZ'
mapping = {}
for i, t in enumerate(freq):
    if i < 27:
        mapping[t] = englishLetterFreq[i]
flag = ''
for c in text:
    if c in mapping.keys():
        flag += mapping[c]
print(flag)

text = open("output.txt",'r').read().decode('hex')
freq = sorted(set(text), key = text.count)[::-1]

# Spaces are most frequent
englishLetterFreq = ' ERNIOSALTHGCUMWBDYPFVKJXQZ'
# Map each ciphertext with a letter
mapping = {}
for i,t in enumerate(freq):
	if i < 27:
		mapping[t] = englishLetterFreq[i]

flag = ''
for c in text:
	if c in mapping.keys():
		flag += mapping[c]

print(flag)