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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: C = None
        self.z: E = None
        self.p: D = None
        self.w: E = None
        self.t: G = None
        self.o: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.t: A = None
        self.q: C = None
        self.x: C = None
        self.txt = txt

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

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

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

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

m.q = d
c.y = m
c.r = i
c.z = l
c.w = l
c.o = l
c.p = a
c.t = d
i.w = d
i.r = l
i.y = h
a.y = h
a.t = m
a.q = i
a.x = i
l.o = h
l.w = d
l.z = a
h.x = c
h.q = c
h.y = c
h.p = a
h.o = d
h.z = l
d.t = c
d.q = c
d.o = a
assert l.z.x.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: C = None
        self.z: E = None
        self.p: D = None
        self.w: E = None
        self.t: G = None
        self.o: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.t: A = None
        self.q: C = None
        self.x: C = None
        self.txt = txt

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

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

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

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

m.q = d
c.y = m
c.r = i
c.z = l
c.w = l
c.o = l
c.p = a
c.t = d
i.w = d
i.r = l
i.y = h
a.y = h
a.t = m
a.q = i
a.x = i
l.o = h
l.w = d
l.z = a
h.x = c
h.q = c
h.y = c
h.p = a
h.o = d
h.z = l
d.t = c
d.q = c
d.o = a
assert l.z.x.y.p.txt == "a"