class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: G = None
        self.t: F = None
        self.x: F = None
        self.txt = txt

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

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

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

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

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

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

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

d.z = g
d.p = f
d.t = k
d.x = k
a.p = k
a.s = k
a.w = f
a.t = g
a.u = h
h.y = f
g.t = d
g.y = d
m.p = d
m.r = k
m.t = g
m.q = h
k.y = f
k.u = a
k.q = g
f.q = a
f.r = d
f.x = d
f.u = d
f.z = m
assert g.t.z.y.z.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: G = None
        self.t: F = None
        self.x: F = None
        self.txt = txt

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

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

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

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

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

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

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

d.z = g
d.p = f
d.t = k
d.x = k
a.p = k
a.s = k
a.w = f
a.t = g
a.u = h
h.y = f
g.t = d
g.y = d
m.p = d
m.r = k
m.t = g
m.q = h
k.y = f
k.u = a
k.q = g
f.q = a
f.r = d
f.x = d
f.u = d
f.z = m
assert g.t.z.y.z.y.x.txt == "k"