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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: C = None
        self.o: A = None
        self.v: C = None
        self.txt = txt

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

l = A("l")
d = B("d")
k = C("k")
e = D("e")
f = E("f")
a = D("a")

l.u = f
d.p = f
d.z = e
k.x = d
k.v = l
e.q = l
e.o = l
e.w = k
e.v = k
f.u = k
f.x = e
a.q = l
a.o = l
a.w = k
a.v = k
assert e.o.u.u.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: C = None
        self.o: A = None
        self.v: C = None
        self.txt = txt

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

l = A("l")
d = B("d")
k = C("k")
e = D("e")
f = E("f")
a = D("a")

l.u = f
d.p = f
d.z = e
k.x = d
k.v = l
e.q = l
e.o = l
e.w = k
e.v = k
f.u = k
f.x = e
a.q = l
a.o = l
a.w = k
a.v = k
assert e.o.u.u.v.u.txt == "f"