Essays on the functioning of housing and labor markets