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

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

c = A("c")
m = B("m")
d = B("d")
j = B("j")
f = B("f")
i = B("i")
a = A("a")
n = B("n")
h = B("h")
e = B("e")

c.v = a
c.x = i
m.s = c
m.w = c
d.s = c
d.w = c
j.s = c
j.w = c
f.s = a
f.w = c
i.s = a
i.w = c
a.v = c
a.x = i
n.s = a
n.w = c
h.s = c
h.w = a
e.s = c
e.w = a
assert e.w.v.v.x.s.v.x.s.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: B = None
        self.txt = txt

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

c = A("c")
m = B("m")
d = B("d")
j = B("j")
f = B("f")
i = B("i")
a = A("a")
n = B("n")
h = B("h")
e = B("e")

c.v = a
c.x = i
m.s = c
m.w = c
d.s = c
d.w = c
j.s = c
j.w = c
f.s = a
f.w = c
i.s = a
i.w = c
a.v = c
a.x = i
n.s = a
n.w = c
h.s = c
h.w = a
e.s = c
e.w = a
assert e.w.v.v.x.s.v.x.s.v.x.txt == "i"