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

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

e = A("e")
j = B("j")
h = A("h")
b = B("b")
f = A("f")
g = A("g")
l = B("l")

e.s = f
e.u = h
j.t = h
h.s = f
h.u = e
b.t = e
f.s = g
f.u = e
g.s = f
g.u = h
l.t = g
assert l.t.s.u.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: A = None
        self.txt = txt

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

e = A("e")
j = B("j")
h = A("h")
b = B("b")
f = A("f")
g = A("g")
l = B("l")

e.s = f
e.u = h
j.t = h
h.s = f
h.u = e
b.t = e
f.s = g
f.u = e
g.s = f
g.u = h
l.t = g
assert l.t.s.u.s.u.txt == "e"