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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: A = None
        self.x: H = None
        self.y: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: A = None
        self.v: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.r: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: G = None
        self.o: G = None
        self.x: H = None
        self.r: G = None
        self.z: E = None
        self.w: D = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: A = None
        self.x: H = None
        self.y: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: A = None
        self.v: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.r: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: G = None
        self.o: G = None
        self.x: H = None
        self.r: G = None
        self.z: E = None
        self.w: D = None
        self.txt = txt

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

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

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

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