class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.o: 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: B = None
        self.txt = txt

k = A("k")
i = B("i")
a = C("a")
b = B("b")

k.u = i
k.o = i
i.u = b
a.q = b
b.u = i
assert k.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.o: 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: B = None
        self.txt = txt

k = A("k")
i = B("i")
a = C("a")
b = B("b")

k.u = i
k.o = i
i.u = b
a.q = b
b.u = i
assert k.u.u.u.txt == "i"