Match me if you can

Problem Name:
Match me if you can
Site:Spoj
Links:
Tags:
Problem setters: