Spent over an hour trying to figure out the incomplete sequenses, only to realize it was easier to begin from the other way around. After that, solution came out nice and clean.