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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: D = None
        self.o: D = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: B = None
        self.u: D = None
        self.x: D = None
        self.p: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: D = None
        self.x: C = None
        self.z: B = None
        self.q: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: A = None
        self.o: E = None
        self.x: B = None
        self.z: D = None
        self.y: E = None
        self.txt = txt

a = A("a")
n = B("n")
f = C("f")
l = D("l")
d = E("d")
g = F("g")
m = C("m")
k = D("k")
h = D("h")

a.p = l
a.w = l
n.w = d
n.q = g
f.q = g
f.x = k
f.o = l
f.r = a
l.t = d
l.s = n
l.u = k
l.x = k
l.p = g
d.y = m
d.r = h
d.x = f
d.z = n
d.q = n
g.r = m
g.w = a
g.o = d
g.y = d
g.x = n
g.z = l
m.q = g
m.x = l
m.o = l
m.r = a
k.t = d
k.s = n
k.u = l
k.x = l
k.p = g
h.t = d
h.s = n
h.u = k
h.x = k
h.p = g
assert n.w.y.x.s.q.w.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: D = None
        self.o: D = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: B = None
        self.u: D = None
        self.x: D = None
        self.p: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: D = None
        self.x: C = None
        self.z: B = None
        self.q: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: A = None
        self.o: E = None
        self.x: B = None
        self.z: D = None
        self.y: E = None
        self.txt = txt

a = A("a")
n = B("n")
f = C("f")
l = D("l")
d = E("d")
g = F("g")
m = C("m")
k = D("k")
h = D("h")

a.p = l
a.w = l
n.w = d
n.q = g
f.q = g
f.x = k
f.o = l
f.r = a
l.t = d
l.s = n
l.u = k
l.x = k
l.p = g
d.y = m
d.r = h
d.x = f
d.z = n
d.q = n
g.r = m
g.w = a
g.o = d
g.y = d
g.x = n
g.z = l
m.q = g
m.x = l
m.o = l
m.r = a
k.t = d
k.s = n
k.u = l
k.x = l
k.p = g
h.t = d
h.s = n
h.u = k
h.x = k
h.p = g
assert n.w.y.x.s.q.w.w.p.txt == "g"