Juan and Alex had an equal number of nickels. After Juan gave away 48 nickels and Alex gave away 66 nickels, Juan had 4 times as many nickels as Alex. How many nickels did each have at first?

let x be the number of nickels did each have at first

x - 48 = 4 (x - 66)
x - 48 = 4x - 264
-3x = -216
x = 72 nickels