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

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

e = A("e")
d = B("d")
c = B("c")
h = B("h")
l = A("l")
m = B("m")
a = A("a")
g = B("g")
j = A("j")

e.u = l
d.s = j
d.v = j
c.s = j
c.v = l
h.s = j
h.v = l
l.u = e
m.s = j
m.v = a
a.u = j
g.s = a
g.v = e
j.u = l
assert e.u.u.u.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

e = A("e")
d = B("d")
c = B("c")
h = B("h")
l = A("l")
m = B("m")
a = A("a")
g = B("g")
j = A("j")

e.u = l
d.s = j
d.v = j
c.s = j
c.v = l
h.s = j
h.v = l
l.u = e
m.s = j
m.v = a
a.u = j
g.s = a
g.v = e
j.u = l
assert e.u.u.u.u.u.u.u.u.u.txt == "l"