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

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

f = A("f")
m = B("m")
l = B("l")
e = A("e")
c = A("c")

f.s = e
f.x = c
m.w = l
m.u = l
l.w = m
l.u = m
e.s = c
e.x = c
c.s = e
c.x = e
assert f.x.s.s.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: A = None
        self.txt = txt

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

f = A("f")
m = B("m")
l = B("l")
e = A("e")
c = A("c")

f.s = e
f.x = c
m.w = l
m.u = l
l.w = m
l.u = m
e.s = c
e.x = c
c.s = e
c.x = e
assert f.x.s.s.s.x.txt == "c"