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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: C = None
        self.q: F = None
        self.u: F = None
        self.z: F = None
        self.txt = txt

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

k.z = h
k.w = n
b.w = i
b.p = g
b.q = h
h.p = e
h.x = g
h.s = n
h.t = b
e.u = n
e.x = g
e.r = i
e.z = k
e.q = h
n.z = h
g.r = e
i.w = b
i.x = h
i.q = g
i.u = g
i.z = g
assert k.z.t.q.p.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: C = None
        self.q: F = None
        self.u: F = None
        self.z: F = None
        self.txt = txt

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

k.z = h
k.w = n
b.w = i
b.p = g
b.q = h
h.p = e
h.x = g
h.s = n
h.t = b
e.u = n
e.x = g
e.r = i
e.z = k
e.q = h
n.z = h
g.r = e
i.w = b
i.x = h
i.q = g
i.u = g
i.z = g
assert k.z.t.q.p.z.z.txt == "h"