Plug and Multiplug is the right guess! So basically after each action,
1. Check from each powered multiplug if it has a cycle or it's connected from the source. If not, turn its power off.
2. From each powered multiplug and the source, pass the electricity via DFS.