class Node:
    def __init__(self, x: int, z: int, index: int, name: str = "", type: int = 0):
        self.x: int = x
        self.z: int = z
        self.index: int = index
        self.name: str = name
        self.type: int = (0 if name == "" else type)

    def rename_node(self, name: str) -> None:
        if self.name == "" and name != "":
            self.type = 1
        self.name = name
        if name == "":
            self.type = 0
    
    def set_type(self, type: int = 0) -> None:
        if type != 0:
            self.type = 0 if self.name == "" else type