Solution to filter and union in assign 3