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

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: G = None
        self.v: E = None
        self.q: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: H = None
        self.r: A = None
        self.v: G = None
        self.u: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: E = None
        self.u: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: C = None
        self.x: H = None
        self.s: A = None
        self.q: C = None
        self.v: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: D = None
        self.x: G = None
        self.txt = txt

g = A("g")
d = B("d")
m = C("m")
h = D("h")
n = E("n")
i = F("i")
k = G("k")
e = H("e")

g.p = k
g.z = k
g.w = e
d.s = g
d.u = m
d.v = m
d.r = m
m.z = i
m.y = k
m.v = n
m.q = d
h.w = i
h.u = i
h.o = e
h.r = g
h.v = k
n.p = g
n.o = k
i.q = g
i.o = n
i.u = k
k.p = n
k.u = m
k.q = m
k.x = e
k.s = g
k.v = g
e.w = n
e.u = h
e.x = k
assert e.x.p.p.w.x.q.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.z: G = None
        self.w: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: G = None
        self.v: E = None
        self.q: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: H = None
        self.r: A = None
        self.v: G = None
        self.u: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: E = None
        self.u: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: C = None
        self.x: H = None
        self.s: A = None
        self.q: C = None
        self.v: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: D = None
        self.x: G = None
        self.txt = txt

g = A("g")
d = B("d")
m = C("m")
h = D("h")
n = E("n")
i = F("i")
k = G("k")
e = H("e")

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