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

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

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

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

e.t = k
m.o = k
k.o = e
f.o = k
assert k.o.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

e.t = k
m.o = k
k.o = e
f.o = k
assert k.o.t.o.txt == "e"