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

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

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

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

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

c.z = a
c.s = i
i.s = n
i.z = n
i.t = e
i.p = l
a.w = j
a.q = i
g.o = a
g.r = a
g.w = h
n.s = l
n.z = i
n.p = i
n.t = c
d.o = a
d.r = a
d.w = h
h.o = a
h.r = a
h.w = g
l.s = i
l.z = n
l.p = n
l.t = c
j.o = a
j.r = a
j.w = h
e.z = a
e.s = l
assert j.o.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: B = None
        self.txt = txt

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

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

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

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

c.z = a
c.s = i
i.s = n
i.z = n
i.t = e
i.p = l
a.w = j
a.q = i
g.o = a
g.r = a
g.w = h
n.s = l
n.z = i
n.p = i
n.t = c
d.o = a
d.r = a
d.w = h
h.o = a
h.r = a
h.w = g
l.s = i
l.z = n
l.p = n
l.t = c
j.o = a
j.r = a
j.w = h
e.z = a
e.s = l
assert j.o.q.t.txt == "e"