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

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.r: H = None
        self.q: H = None
        self.t: G = None
        self.z: C = None
        self.x: G = None
        self.p: H = None
        self.w: A = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: G = None
        self.u: F = None
        self.w: G = None
        self.y: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.r: H = None
        self.q: H = None
        self.t: G = None
        self.z: C = None
        self.x: G = None
        self.p: H = None
        self.w: A = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: G = None
        self.u: F = None
        self.w: G = None
        self.y: C = None
        self.txt = txt

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

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