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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: E = None
        self.s: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: A = None
        self.o: G = None
        self.u: C = None
        self.v: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: A = None
        self.v: A = None
        self.q: D = None
        self.x: G = None
        self.w: B = None
        self.p: G = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: E = None
        self.s: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: A = None
        self.o: G = None
        self.u: C = None
        self.v: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: A = None
        self.v: A = None
        self.q: D = None
        self.x: G = None
        self.w: B = None
        self.p: G = None
        self.txt = txt

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

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

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