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

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

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

f = A("f")
d = B("d")
n = C("n")
l = B("l")

f.y = d
d.t = n
n.x = f
n.o = f
l.t = n
assert l.t.x.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

f = A("f")
d = B("d")
n = C("n")
l = B("l")

f.y = d
d.t = n
n.x = f
n.o = f
l.t = n
assert l.t.x.y.t.txt == "n"