class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: D = None
        self.y: B = None
        self.o: B = None
        self.u: G = None
        self.z: F = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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