ZigZag solution