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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: F = None
        self.o: F = None
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: C = None
        self.o: C = None
        self.q: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: D = None
        self.r: E = None
        self.w: C = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

g = A("g")
a = B("a")
j = C("j")
n = D("n")
i = E("i")
k = F("k")
f = E("f")
d = C("d")
e = C("e")
m = B("m")

g.p = d
g.u = a
a.z = n
a.v = k
a.o = k
a.w = f
j.w = n
j.v = e
j.o = e
j.q = g
n.s = j
n.z = k
n.x = d
i.o = m
i.u = n
i.p = n
i.r = f
i.w = e
k.p = e
f.o = m
f.u = n
f.p = n
f.r = i
f.w = e
d.w = n
d.v = j
d.o = e
d.q = g
e.w = n
e.v = d
e.o = j
e.q = g
m.z = n
m.v = k
m.o = k
m.w = f
assert m.w.w.w.s.q.p.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: F = None
        self.o: F = None
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: C = None
        self.o: C = None
        self.q: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: D = None
        self.r: E = None
        self.w: C = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

g = A("g")
a = B("a")
j = C("j")
n = D("n")
i = E("i")
k = F("k")
f = E("f")
d = C("d")
e = C("e")
m = B("m")

g.p = d
g.u = a
a.z = n
a.v = k
a.o = k
a.w = f
j.w = n
j.v = e
j.o = e
j.q = g
n.s = j
n.z = k
n.x = d
i.o = m
i.u = n
i.p = n
i.r = f
i.w = e
k.p = e
f.o = m
f.u = n
f.p = n
f.r = i
f.w = e
d.w = n
d.v = j
d.o = e
d.q = g
e.w = n
e.v = d
e.o = j
e.q = g
m.z = n
m.v = k
m.o = k
m.w = f
assert m.w.w.w.s.q.p.q.p.txt == "d"