first go

got stuck in the sorting bit, going to figure that out first
fixed solution