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

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

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

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

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

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

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

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

c.y = k
c.r = k
c.w = b
k.t = l
k.o = b
b.x = c
l.y = k
l.r = k
l.w = b
assert k.o.x.r.t.txt == "l"