Peel and dice the onions and sweat in a little oil or butter until translucent.
In the meantime, grease a suitably large casserole dish, pour in the room-warm mashed potatoes and pierce a little airy with a fork or spoon so that the heat can circulate better afterwards.
Cut the ham into fine strips and spread over the puree. Salt and pepper the onions, stir again and also spread over them.
Sprinkle the casserole with the parmesan and top with the cheddar and bake in the oven for 20 minutes.