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

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

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

l = A("l")
k = B("k")
e = C("e")
d = B("d")
h = A("h")
i = B("i")

l.v = e
k.z = h
k.u = h
k.p = i
e.t = h
d.z = l
d.u = l
d.p = i
h.v = e
i.z = l
i.u = l
i.p = d
assert e.t.v.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

l = A("l")
k = B("k")
e = C("e")
d = B("d")
h = A("h")
i = B("i")

l.v = e
k.z = h
k.u = h
k.p = i
e.t = h
d.z = l
d.u = l
d.p = i
h.v = e
i.z = l
i.u = l
i.p = d
assert e.t.v.t.v.txt == "e"