class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: A = None
        self.w: C = None
        self.r: D = None
        self.txt = txt

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

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

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

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

h = A("h")
j = B("j")
d = C("d")
a = D("a")
c = E("c")
m = A("m")
f = C("f")
b = A("b")
l = B("l")

h.q = c
h.t = b
h.w = d
h.r = a
j.p = l
j.w = c
j.z = a
j.q = f
d.s = f
d.x = c
d.t = c
d.w = a
a.o = c
a.r = c
a.q = b
c.s = l
c.t = m
m.q = c
m.t = b
m.w = d
m.r = a
f.s = d
f.x = c
f.t = c
f.w = a
b.q = c
b.t = h
b.w = f
b.r = a
l.p = j
l.w = c
l.z = a
l.q = f
assert m.q.s.w.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: A = None
        self.w: C = None
        self.r: D = None
        self.txt = txt

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

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

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

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

h = A("h")
j = B("j")
d = C("d")
a = D("a")
c = E("c")
m = A("m")
f = C("f")
b = A("b")
l = B("l")

h.q = c
h.t = b
h.w = d
h.r = a
j.p = l
j.w = c
j.z = a
j.q = f
d.s = f
d.x = c
d.t = c
d.w = a
a.o = c
a.r = c
a.q = b
c.s = l
c.t = m
m.q = c
m.t = b
m.w = d
m.r = a
f.s = d
f.x = c
f.t = c
f.w = a
b.q = c
b.t = h
b.w = f
b.r = a
l.p = j
l.w = c
l.z = a
l.q = f
assert m.q.s.w.t.r.txt == "a"