Ridgefield beats Hamden, heads to Class LL quarterfinals