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

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: B = None
        self.w: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: D = None
        self.txt = txt

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

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

n.s = f
n.q = m
f.x = a
f.r = g
f.w = m
m.s = l
j.r = e
j.x = e
a.t = i
a.s = m
a.q = n
i.s = f
i.q = m
g.x = h
g.r = f
g.w = m
h.t = n
h.q = n
h.s = m
l.t = n
l.s = m
l.q = i
e.r = j
e.x = j
assert a.t.s.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: B = None
        self.w: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: D = None
        self.txt = txt

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

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

n.s = f
n.q = m
f.x = a
f.r = g
f.w = m
m.s = l
j.r = e
j.x = e
a.t = i
a.s = m
a.q = n
i.s = f
i.q = m
g.x = h
g.r = f
g.w = m
h.t = n
h.q = n
h.s = m
l.t = n
l.s = m
l.q = i
e.r = j
e.x = j
assert a.t.s.r.r.txt == "f"