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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: C = None
        self.w: B = None
        self.s: B = None
        self.y: C = None
        self.q: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: B = None
        self.s: B = None
        self.u: A = None
        self.x: E = None
        self.t: G = None
        self.y: B = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: C = None
        self.w: B = None
        self.s: B = None
        self.y: C = None
        self.q: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: B = None
        self.s: B = None
        self.u: A = None
        self.x: E = None
        self.t: G = None
        self.y: B = None
        self.txt = txt

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

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

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