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

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

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

f = A("f")
l = B("l")
k = C("k")
c = C("c")

f.x = l
f.r = l
l.x = c
l.u = c
k.o = c
k.v = c
c.o = k
c.v = k
assert f.x.x.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: B = None
        self.txt = txt

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

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

f = A("f")
l = B("l")
k = C("k")
c = C("c")

f.x = l
f.r = l
l.x = c
l.u = c
k.o = c
k.v = c
c.o = k
c.v = k
assert f.x.x.o.o.txt == "c"