import re

for filename in ['index.html', 'about.html', 'gallery.html']:
    with open(filename, 'r', encoding='utf-8') as f:
        content = f.read()

    def replace_func(m):
        original_line = m.group(1)
        new_line = original_line.replace('about.html', 'gallery.html').replace('About Us', 'Gallery')
        return original_line + '\n' + new_line
        
    new_content = re.sub(r'([ \t]*<a href="about\.html"[^>]*>About Us</a>)', replace_func, content)
    
    with open(filename, 'w', encoding='utf-8') as f:
        f.write(new_content)
print('Done updating menu')
