There were 25 birds on two branches. After a while 5 birds from the first branch flew over to the second and after a while longer 7 birds from the second flew away. In that moment on the first branch there were twice as many birds than on the second. How many birds were there on each of the two branches in the beginning?