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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

h = A("h")
b = B("b")
k = C("k")
e = D("e")
g = E("g")
j = F("j")
n = G("n")
m = G("m")

h.p = b
h.u = e
h.z = g
b.z = j
k.t = h
k.q = e
e.r = h
e.t = h
e.z = g
e.q = j
g.v = h
j.y = g
j.u = n
n.p = m
m.p = n
assert k.q.q.y.v.z.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: D = None
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

h = A("h")
b = B("b")
k = C("k")
e = D("e")
g = E("g")
j = F("j")
n = G("n")
m = G("m")

h.p = b
h.u = e
h.z = g
b.z = j
k.t = h
k.q = e
e.r = h
e.t = h
e.z = g
e.q = j
g.v = h
j.y = g
j.u = n
n.p = m
m.p = n
assert k.q.q.y.v.z.v.p.txt == "b"