• + 0 comments
    import re
    
    pattern = r'#[0-9ABCDEFabcdef]{3,6}[();,?]'
    
    N = int(input())
    
    for i in range(N):
        txt = input()
        li = re.findall(pattern, txt)
        if len(li) > 0:
            for a in li:
                print(a[:-1])