class File:
    """structure de file"""
    def __init__(self):
        self.entree = creer_pile()
        self.sortie = creer_pile()

    def est_vide(self):
        return self.entree.est_vide() \
           and self.sortie.est_vide()

    def ajouter(self, x):
        self.entree.empiler(x)

    def retirer(self):
        if self.sortie.est_vide():
            while not self.entree.est_vide():
                self.sortie.empiler(self.entree.depiler())
        if self.sortie.est_vide():
            raise IndexError("retirer sur une file vide")
        return self.sortie.depiler()