import re,sys,html
p,pat=sys.argv[1],sys.argv[2]
t=open(p,encoding='utf-8',errors='replace').read()
t=re.sub(r'<annotation[^>]*>.*?</annotation>','',t,flags=re.S)
t=re.sub(r'</t[dh]>',' | ',t); t=re.sub(r'</tr>','\n',t); t=re.sub(r'<[^>]+>','',t); t=html.unescape(t)
for line in t.split('\n'):
    l=re.sub(r'\s+',' ',line).strip()
    if re.search(pat,l) and len(l)<400: print(l)
