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

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

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

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: C = None
        self.o: C = None
        self.u: H = None
        self.z: E = None
        self.y: F = None
        self.s: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: H = None
        self.z: D = None
        self.u: H = None
        self.p: B = None
        self.o: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: H = None
        self.y: A = None
        self.o: B = None
        self.s: C = None
        self.q: H = None
        self.txt = txt

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

a = A("a")
g = B("g")
f = C("f")
i = D("i")
d = E("d")
n = F("n")
m = G("m")
l = H("l")

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

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

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

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: C = None
        self.o: C = None
        self.u: H = None
        self.z: E = None
        self.y: F = None
        self.s: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: H = None
        self.z: D = None
        self.u: H = None
        self.p: B = None
        self.o: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: H = None
        self.y: A = None
        self.o: B = None
        self.s: C = None
        self.q: H = None
        self.txt = txt

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

a = A("a")
g = B("g")
f = C("f")
i = D("i")
d = E("d")
n = F("n")
m = G("m")
l = H("l")

a.q = f
g.p = a
f.p = m
f.y = d
i.v = n
i.y = n
i.w = f
i.o = f
i.u = l
i.z = d
i.s = g
d.v = i
d.z = i
d.r = l
d.u = l
d.p = g
d.o = n
n.p = i
n.s = a
n.v = g
n.t = m
m.t = n
m.v = l
m.q = l
m.y = a
m.o = g
m.s = f
l.w = f
l.y = a
l.t = n
assert g.p.q.y.o.txt == "n"