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

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

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

i = A("i")
k = B("k")
e = C("e")
n = B("n")

i.x = n
i.u = n
i.q = e
k.r = e
e.v = n
n.r = e
assert k.r.v.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: C = None
        self.u: B = None
        self.txt = txt

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

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

i = A("i")
k = B("k")
e = C("e")
n = B("n")

i.x = n
i.u = n
i.q = e
k.r = e
e.v = n
n.r = e
assert k.r.v.r.v.txt == "n"