A boat goes 12 km upstream and 40 km downstream in 8 hours. It can go 16 km upstream and 32 km downstream in the same time. Find the speed of the oat in still water and the speed of the stream.