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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: B = None
        self.w: F = None
        self.q: D = None
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.z: D = None
        self.y: G = None
        self.p: C = None
        self.o: D = None
        self.w: E = None
        self.txt = txt

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

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

c.z = f
n.o = m
n.s = m
n.t = m
n.q = a
a.p = i
a.v = f
m.v = f
m.x = a
m.t = a
m.y = h
m.q = h
f.t = h
f.w = h
f.p = n
f.z = n
f.q = m
h.q = i
h.y = i
h.z = m
h.o = m
h.p = a
h.w = f
i.w = c
i.u = f
assert n.q.p.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: B = None
        self.w: F = None
        self.q: D = None
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.z: D = None
        self.y: G = None
        self.p: C = None
        self.o: D = None
        self.w: E = None
        self.txt = txt

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

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

c.z = f
n.o = m
n.s = m
n.t = m
n.q = a
a.p = i
a.v = f
m.v = f
m.x = a
m.t = a
m.y = h
m.q = h
f.t = h
f.w = h
f.p = n
f.z = n
f.q = m
h.q = i
h.y = i
h.z = m
h.o = m
h.p = a
h.w = f
i.w = c
i.u = f
assert n.q.p.w.z.txt == "f"