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

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: E = None
        self.q: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: C = None
        self.t: A = None
        self.u: E = None
        self.v: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: D = None
        self.t: A = None
        self.q: F = None
        self.p: A = None
        self.u: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: E = None
        self.q: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: C = None
        self.t: A = None
        self.u: E = None
        self.v: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: D = None
        self.t: A = None
        self.q: F = None
        self.p: A = None
        self.u: F = None
        self.txt = txt

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

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