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

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

f = A("f")
e = B("e")
b = B("b")
g = B("g")
l = B("l")
n = B("n")
a = A("a")
i = B("i")
m = B("m")
k = B("k")

f.s = a
f.y = a
e.x = a
b.x = a
g.x = f
l.x = f
n.x = f
a.s = f
a.y = f
i.x = f
m.x = f
k.x = a
assert g.x.s.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: A = None
        self.txt = txt

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

f = A("f")
e = B("e")
b = B("b")
g = B("g")
l = B("l")
n = B("n")
a = A("a")
i = B("i")
m = B("m")
k = B("k")

f.s = a
f.y = a
e.x = a
b.x = a
g.x = f
l.x = f
n.x = f
a.s = f
a.y = f
i.x = f
m.x = f
k.x = a
assert g.x.s.y.y.y.y.y.txt == "f"