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

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

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

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

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

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

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

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

k.v = i
i.u = k
i.y = l
i.q = j
e.r = k
e.u = i
e.z = i
j.r = k
j.u = i
j.z = i
l.r = k
l.u = i
l.z = i
assert i.y.u.q.r.txt == "k"