class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: C = None
        self.o: G = None
        self.t: C = None
        self.u: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.t: D = None
        self.x: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: A = None
        self.p: C = None
        self.r: F = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.t: D = None
        self.x: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: A = None
        self.p: C = None
        self.r: F = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: B = None
        self.txt = txt

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

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