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

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

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

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

j.r = b
j.u = k
j.o = k
i.v = j
i.r = j
k.r = b
k.y = b
b.v = j
b.r = j
assert i.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: C = None
        self.o: C = None
        self.txt = txt

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

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

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

j.r = b
j.u = k
j.o = k
i.v = j
i.r = j
k.r = b
k.y = b
b.v = j
b.r = j
assert i.r.u.r.txt == "b"