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

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

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

b = A("b")
k = B("k")
m = C("m")
e = A("e")

b.t = k
k.y = e
m.w = k
e.t = k
assert b.t.y.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

b = A("b")
k = B("k")
m = C("m")
e = A("e")

b.t = k
k.y = e
m.w = k
e.t = k
assert b.t.y.t.y.txt == "e"