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

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

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

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

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

l = A("l")
h = B("h")
f = C("f")
j = D("j")
n = E("n")
d = C("d")

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

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

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

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

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

l = A("l")
h = B("h")
f = C("f")
j = D("j")
n = E("n")
d = C("d")

l.x = n
h.u = f
h.o = j
f.q = h
f.o = h
f.t = l
f.v = n
j.w = d
j.z = f
n.s = l
n.q = j
n.x = j
d.q = h
d.o = h
d.t = l
d.v = n
assert l.x.x.z.o.u.txt == "f"