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

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

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

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

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

d = A("d")
b = B("b")
l = C("l")
g = D("g")
a = E("a")
i = E("i")
f = D("f")
k = D("k")
c = E("c")

d.u = k
d.z = g
d.x = b
d.v = f
b.s = l
b.w = d
l.v = c
l.r = d
g.o = i
g.r = f
a.q = b
i.q = b
f.o = i
f.r = g
k.o = a
k.r = g
c.q = b
assert d.u.o.q.w.x.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: D = None
        self.x: B = None
        self.v: D = None
        self.txt = txt

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

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

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

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

d = A("d")
b = B("b")
l = C("l")
g = D("g")
a = E("a")
i = E("i")
f = D("f")
k = D("k")
c = E("c")

d.u = k
d.z = g
d.x = b
d.v = f
b.s = l
b.w = d
l.v = c
l.r = d
g.o = i
g.r = f
a.q = b
i.q = b
f.o = i
f.r = g
k.o = a
k.r = g
c.q = b
assert d.u.o.q.w.x.s.r.txt == "d"