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

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

k = A("k")
m = B("m")
n = A("n")
f = B("f")
c = A("c")
j = B("j")
g = B("g")
i = A("i")
b = A("b")

k.y = f
k.v = f
m.w = j
m.s = g
n.y = g
n.v = j
f.w = g
f.s = m
c.y = j
c.v = g
j.w = m
j.s = g
g.w = f
g.s = j
i.y = f
i.v = g
b.y = j
b.v = m
assert i.v.w.w.s.s.w.s.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: B = None
        self.txt = txt

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

k = A("k")
m = B("m")
n = A("n")
f = B("f")
c = A("c")
j = B("j")
g = B("g")
i = A("i")
b = A("b")

k.y = f
k.v = f
m.w = j
m.s = g
n.y = g
n.v = j
f.w = g
f.s = m
c.y = j
c.v = g
j.w = m
j.s = g
g.w = f
g.s = j
i.y = f
i.v = g
b.y = j
b.v = m
assert i.v.w.w.s.s.w.s.w.s.txt == "g"