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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: E = None
        self.v: D = None
        self.u: F = None
        self.y: C = None
        self.w: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: D = None
        self.txt = txt

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

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

e = A("e")
h = B("h")
b = C("b")
m = D("m")
g = E("g")
l = F("l")
c = E("c")
a = A("a")
n = F("n")
i = D("i")

e.u = g
e.w = c
e.s = a
h.p = a
h.q = c
h.w = c
h.v = i
h.u = l
h.y = b
b.v = g
b.w = c
m.w = b
m.z = i
g.p = c
g.s = a
g.w = l
l.s = e
c.p = g
c.s = e
c.w = n
a.u = g
a.w = c
a.s = e
n.s = e
i.w = b
i.z = m
assert n.s.s.w.p.s.s.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: E = None
        self.s: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: E = None
        self.v: D = None
        self.u: F = None
        self.y: C = None
        self.w: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: D = None
        self.txt = txt

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

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

e = A("e")
h = B("h")
b = C("b")
m = D("m")
g = E("g")
l = F("l")
c = E("c")
a = A("a")
n = F("n")
i = D("i")

e.u = g
e.w = c
e.s = a
h.p = a
h.q = c
h.w = c
h.v = i
h.u = l
h.y = b
b.v = g
b.w = c
m.w = b
m.z = i
g.p = c
g.s = a
g.w = l
l.s = e
c.p = g
c.s = e
c.w = n
a.u = g
a.w = c
a.s = e
n.s = e
i.w = b
i.z = m
assert n.s.s.w.p.s.s.w.w.txt == "n"