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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

a = A("a")
d = B("d")
e = C("e")
f = D("f")
k = E("k")
j = E("j")
l = B("l")
n = C("n")
h = A("h")
c = B("c")

a.r = d
a.q = k
d.q = l
d.o = l
d.s = l
d.w = f
e.s = c
e.t = c
e.w = n
e.x = d
e.o = f
f.r = c
f.s = e
f.z = h
k.u = d
j.u = d
l.q = c
l.w = f
l.o = d
l.s = d
n.s = d
n.t = d
n.w = e
n.x = l
n.o = f
h.r = c
h.q = j
c.q = d
c.w = f
c.o = l
c.s = l
assert f.r.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

a = A("a")
d = B("d")
e = C("e")
f = D("f")
k = E("k")
j = E("j")
l = B("l")
n = C("n")
h = A("h")
c = B("c")

a.r = d
a.q = k
d.q = l
d.o = l
d.s = l
d.w = f
e.s = c
e.t = c
e.w = n
e.x = d
e.o = f
f.r = c
f.s = e
f.z = h
k.u = d
j.u = d
l.q = c
l.w = f
l.o = d
l.s = d
n.s = d
n.t = d
n.w = e
n.x = l
n.o = f
h.r = c
h.q = j
c.q = d
c.w = f
c.o = l
c.s = l
assert f.r.w.s.txt == "e"