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

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

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

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

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

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

g.u = b
g.s = n
n.w = i
n.v = c
i.w = c
i.v = n
c.w = i
c.v = i
b.u = j
b.s = c
j.u = k
j.s = i
e.u = f
e.s = i
k.u = l
k.s = c
f.u = b
f.s = c
l.u = b
l.s = c
assert f.s.v.v.w.v.v.w.txt == "i"