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

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: E = None
        self.r: E = None
        self.v: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: C = None
        self.u: B = None
        self.p: D = None
        self.z: B = None
        self.w: F = None
        self.txt = txt

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

m = A("m")
j = B("j")
e = C("e")
f = D("f")
c = E("c")
g = F("g")
n = F("n")
h = C("h")

m.q = f
j.z = m
j.w = c
e.s = n
e.x = c
e.r = c
e.v = f
f.w = n
f.p = m
f.t = m
f.x = c
f.r = j
c.r = g
c.v = e
c.u = j
c.z = j
c.p = f
c.w = n
g.w = n
g.t = f
g.o = m
g.x = m
g.z = c
n.w = g
n.t = f
n.o = m
n.x = m
n.z = c
h.s = n
h.x = c
h.r = c
h.v = f
assert m.q.x.p.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: E = None
        self.r: E = None
        self.v: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: C = None
        self.u: B = None
        self.p: D = None
        self.z: B = None
        self.w: F = None
        self.txt = txt

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

m = A("m")
j = B("j")
e = C("e")
f = D("f")
c = E("c")
g = F("g")
n = F("n")
h = C("h")

m.q = f
j.z = m
j.w = c
e.s = n
e.x = c
e.r = c
e.v = f
f.w = n
f.p = m
f.t = m
f.x = c
f.r = j
c.r = g
c.v = e
c.u = j
c.z = j
c.p = f
c.w = n
g.w = n
g.t = f
g.o = m
g.x = m
g.z = c
n.w = g
n.t = f
n.o = m
n.x = m
n.z = c
h.s = n
h.x = c
h.r = c
h.v = f
assert m.q.x.p.w.z.txt == "c"