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

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

j = A("j")
k = B("k")
g = B("g")
d = A("d")
l = A("l")
b = B("b")
f = A("f")
h = B("h")
a = A("a")
i = B("i")

j.v = k
j.x = i
k.s = j
k.u = h
g.s = j
g.u = b
d.v = k
d.x = k
l.v = h
l.x = h
b.s = j
b.u = i
f.v = h
f.x = k
h.s = f
h.u = i
a.v = h
a.x = k
i.s = a
i.u = b
assert i.s.v.u.u.u.s.v.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: B = None
        self.txt = txt

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

j = A("j")
k = B("k")
g = B("g")
d = A("d")
l = A("l")
b = B("b")
f = A("f")
h = B("h")
a = A("a")
i = B("i")

j.v = k
j.x = i
k.s = j
k.u = h
g.s = j
g.u = b
d.v = k
d.x = k
l.v = h
l.x = h
b.s = j
b.u = i
f.v = h
f.x = k
h.s = f
h.u = i
a.v = h
a.x = k
i.s = a
i.u = b
assert i.s.v.u.u.u.s.v.u.u.u.txt == "i"