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

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

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

d = A("d")
g = B("g")
e = C("e")
k = B("k")

d.o = k
d.y = e
g.o = d
g.w = d
g.t = e
e.r = k
e.x = d
k.o = d
k.w = d
k.t = e
assert k.o.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: C = None
        self.txt = txt

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

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

d = A("d")
g = B("g")
e = C("e")
k = B("k")

d.o = k
d.y = e
g.o = d
g.w = d
g.t = e
e.r = k
e.x = d
k.o = d
k.w = d
k.t = e
assert k.o.y.r.txt == "k"