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

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

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

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

l.u = h
i.w = n
i.z = l
i.v = l
h.v = l
n.w = i
n.z = l
n.v = l
assert h.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

l.u = h
i.w = n
i.z = l
i.v = l
h.v = l
n.w = i
n.z = l
n.v = l
assert h.v.u.v.txt == "l"