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

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: D = None
        self.t: B = None
        self.p: D = None
        self.txt = txt

d = A("d")
f = B("f")
g = C("g")
n = D("n")
a = C("a")
e = B("e")
h = D("h")
l = C("l")
m = C("m")
j = B("j")

d.q = n
d.x = a
f.p = d
f.z = d
f.y = g
f.q = h
g.w = e
g.s = a
g.t = d
g.z = f
n.y = g
n.u = h
n.p = h
n.t = j
a.w = e
a.z = e
a.s = l
a.t = d
e.p = d
e.z = d
e.y = l
e.q = h
h.y = a
h.u = n
h.p = n
h.t = f
l.w = j
l.s = m
l.t = d
l.z = e
m.w = e
m.z = e
m.s = g
m.t = d
j.p = d
j.z = d
j.y = m
j.q = h
assert f.y.z.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: D = None
        self.t: B = None
        self.p: D = None
        self.txt = txt

d = A("d")
f = B("f")
g = C("g")
n = D("n")
a = C("a")
e = B("e")
h = D("h")
l = C("l")
m = C("m")
j = B("j")

d.q = n
d.x = a
f.p = d
f.z = d
f.y = g
f.q = h
g.w = e
g.s = a
g.t = d
g.z = f
n.y = g
n.u = h
n.p = h
n.t = j
a.w = e
a.z = e
a.s = l
a.t = d
e.p = d
e.z = d
e.y = l
e.q = h
h.y = a
h.u = n
h.p = n
h.t = f
l.w = j
l.s = m
l.t = d
l.z = e
m.w = e
m.z = e
m.s = g
m.t = d
j.p = d
j.z = d
j.y = m
j.q = h
assert f.y.z.z.x.txt == "a"