#!/usr/bin/python

from Crypto.Cipher import Blowfish
import sys

file = open("bf-encrypted.jpg").read()

while True:
	key = sys.stdin.readline()[:-1]
	decrypter =  Blowfish.new(key)
	if decrypter.decrypt(file[:8])[:3] == "\xff\xd8\xff":
		print "KEY: %s" % key

