class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

n = A("n")
h = B("h")
l = C("l")
m = D("m")
i = D("i")

n.t = h
n.v = m
h.v = n
l.x = m
m.u = i
i.u = m
assert i.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

n = A("n")
h = B("h")
l = C("l")
m = D("m")
i = D("i")

n.t = h
n.v = m
h.v = n
l.x = m
m.u = i
i.u = m
assert i.u.u.u.txt == "m"