At one point, I read through the NATO articles. There was plenty of detail on how a new nation might join - but I saw nothing on how an existing member might be ejected. Have you read these? It might be that there isn't a way to eject a member nation (including Hungary) from NATO.
No idea on the EU.