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

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

c = A("c")
n = B("n")
d = B("d")
g = B("g")
b = A("b")
f = A("f")
l = A("l")

c.t = n
c.s = b
n.y = b
n.w = f
d.y = b
d.w = l
g.y = b
g.w = c
b.t = n
b.s = c
f.t = n
f.s = l
l.t = d
l.s = f
assert f.t.y.s.t.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: A = None
        self.txt = txt

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

c = A("c")
n = B("n")
d = B("d")
g = B("g")
b = A("b")
f = A("f")
l = A("l")

c.t = n
c.s = b
n.y = b
n.w = f
d.y = b
d.w = l
g.y = b
g.w = c
b.t = n
b.s = c
f.t = n
f.s = l
l.t = d
l.s = f
assert f.t.y.s.t.y.s.txt == "c"