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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: C = None
        self.o: D = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: C = None
        self.o: D = None
        self.txt = txt

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

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

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

d.x = f
d.s = f
c.r = n
h.u = d
h.s = l
h.o = a
m.q = l
m.r = f
f.t = h
f.r = m
f.u = n
n.q = h
n.r = f
l.u = d
l.s = h
l.o = a
a.q = l
a.r = f
assert c.r.r.t.u.x.u.r.t.txt == "h"