Beverly firefighters come to rescue of 3-year-old stuck in railing