# your code goes here
def txt():
    txt_input = input('Р’РІРµРґС–С‚СЊ РЅР°Р·РІСѓ С‚РµРєСЃС‚РѕРІРѕРіРѕ РґРѕРєСѓРјРµРЅС‚Сѓ: ')
    #ввести назву txt
    txt_output = []
    file = open(txt_input, 'tw')
    for line in file:
        txt_output.append(line.split())
    print(txt_output)
    txt_out = int(input('Р’РІРµРґС–С‚СЊ РїРѕСЂСЏРґРєРѕРІРёР№ РЅРѕРјРµСЂ СЃР»РѕРІР°, РїС–СЃР»СЏ СЏРєРѕРіРѕ РІРё С…РѕС‡РµС‚Рµ РґРѕРґР°С‚Рё СЃРІС–Р№ С‚РµРєСЃС‚: '))
    #ввести номер слова від якого вставляти txt
    txt_append = split(str(input('Р’РІРµРґС–С‚СЊ С‚РµРєСЃС‚, СЏРєРёР№ С…РѕС‡РµС‚Рµ РґРѕРґР°С‚Рё: ')))
    #що саме вставляти
    txt_output.insert(txt_out, txt_append)
    txt_output = sum(txt_output)
    file.write(txt_output)
    file.close()
x = int(input('Р’РІРµРґС–С‚СЊ 1 РґР»СЏ С‚РѕРіРѕ, С‰РѕР± РїСЂРѕРґРѕРІР¶РёС‚Рё: '))
#ввести 1 щоб продовжити
while x == 1:
    txt()
    x = int(input('Р’РІРµРґС–С‚СЊ 1 РґР»СЏ С‚РѕРіРѕ, С‰РѕР± РїСЂРѕРґРѕРІР¶РёС‚Рё: '))
    #те ж саме
print('Р¦Рµ РЅРµ 1, С‚РѕРјСѓ СЏ Р·Р°РІРµСЂС€СѓСЋ СЂРѕР±РѕС‚Сѓ.')
#завершую роботу