Multitasking with two switches and three relays