working greedy