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

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

g = A("g")
b = B("b")
e = B("e")
n = A("n")

g.u = n
g.s = n
b.y = e
e.y = b
n.u = g
n.s = g
assert e.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: A = None
        self.txt = txt

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

g = A("g")
b = B("b")
e = B("e")
n = A("n")

g.u = n
g.s = n
b.y = e
e.y = b
n.u = g
n.s = g
assert e.y.y.y.y.txt == "e"