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

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

b = A("b")
d = B("d")
a = A("a")
e = A("e")
f = A("f")
n = A("n")
i = B("i")
l = A("l")

b.x = i
d.s = i
d.t = n
a.x = d
e.x = i
f.x = i
n.x = d
i.s = d
i.t = b
l.x = i
assert a.x.s.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

b = A("b")
d = B("d")
a = A("a")
e = A("e")
f = A("f")
n = A("n")
i = B("i")
l = A("l")

b.x = i
d.s = i
d.t = n
a.x = d
e.x = i
f.x = i
n.x = d
i.s = d
i.t = b
l.x = i
assert a.x.s.s.t.txt == "n"