# your code goes here

a = ['<a1>', '<a2>', '<a3>', '', '<a5>']
b = ['<b1>', '<b2>', '<b3>', '', '<b5>']
txt = '<a1> test <a2> test <a3> test <a4> test <a5>'

for idx, val in enumerate(a):
    txt = txt.replace(val, b[idx])

print(txt)