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

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

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

j = A("j")
a = B("a")
f = C("f")
d = B("d")
m = C("m")
l = B("l")

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

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

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

j = A("j")
a = B("a")
f = C("f")
d = B("d")
m = C("m")
l = B("l")

j.t = a
j.y = f
a.x = j
a.s = j
f.o = a
d.x = j
d.s = j
m.o = l
l.x = j
l.s = j
assert a.s.t.x.t.s.txt == "j"