Seven lamps are fixed in a ring round a garden pond. Each lamp is to be painted red, green or blue, and two lamps side by side in the ring must get different colours. The lamps stay in their places, so a painting turned round the ring counts as a different painting. How many paintings are possible?