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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

a.x = e
a.r = e
a.v = l
f.y = e
f.z = e
e.w = j
e.v = f
e.q = d
l.o = e
l.q = e
l.u = e
d.r = a
d.z = f
d.o = f
j.x = e
j.r = e
j.v = l
assert a.v.o.q.r.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: C = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

a.x = e
a.r = e
a.v = l
f.y = e
f.z = e
e.w = j
e.v = f
e.q = d
l.o = e
l.q = e
l.u = e
d.r = a
d.z = f
d.o = f
j.x = e
j.r = e
j.v = l
assert a.v.o.q.r.x.q.txt == "d"