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

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: G = None
        self.z: G = None
        self.w: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: D = None
        self.o: A = None
        self.q: C = None
        self.z: E = None
        self.s: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: G = None
        self.z: G = None
        self.w: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: D = None
        self.o: A = None
        self.q: C = None
        self.z: E = None
        self.s: D = None
        self.txt = txt

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

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