#!/usr/bin/python3

import sys

def ham(line):
    if 'Hamlet' in line:
        return True
    else:
        return False

for line in sys.stdin:
    if ham(line):
        print(line, end='')