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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: G = None
        self.z: C = None
        self.v: C = None
        self.t: G = None
        self.txt = txt

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

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

c.w = i
c.t = h
m.x = a
a.y = d
a.p = d
a.w = n
a.q = m
i.r = c
i.x = a
i.z = d
i.u = n
n.t = h
n.p = h
n.y = a
n.x = a
n.q = m
h.x = d
h.t = d
h.z = a
h.v = a
d.x = n
d.v = n
d.p = a
d.w = h
assert n.p.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: G = None
        self.z: C = None
        self.v: C = None
        self.t: G = None
        self.txt = txt

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

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

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