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

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

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

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

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

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

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

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

h.z = l
h.v = k
i.u = k
l.q = h
l.v = h
e.q = h
e.v = h
j.u = i
d.u = k
k.u = d
assert e.v.v.u.u.u.u.txt == "k"