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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: C = None
        self.r: B = None
        self.w: E = None
        self.u: C = None
        self.txt = txt

d = A("d")
i = B("i")
c = C("c")
j = D("j")
e = E("e")
n = D("n")
f = E("f")
b = D("b")
l = D("l")
k = B("k")

d.y = c
d.r = c
i.w = c
i.t = l
i.s = f
c.x = d
c.r = d
c.o = d
c.z = f
c.v = k
j.v = c
j.x = c
e.p = k
e.o = c
e.u = c
e.r = i
e.w = f
n.v = c
n.x = c
f.p = k
f.r = k
f.o = c
f.u = c
f.w = e
b.v = c
b.x = c
l.v = c
l.x = c
k.w = c
k.t = b
k.s = e
assert k.s.p.s.u.o.r.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: C = None
        self.r: B = None
        self.w: E = None
        self.u: C = None
        self.txt = txt

d = A("d")
i = B("i")
c = C("c")
j = D("j")
e = E("e")
n = D("n")
f = E("f")
b = D("b")
l = D("l")
k = B("k")

d.y = c
d.r = c
i.w = c
i.t = l
i.s = f
c.x = d
c.r = d
c.o = d
c.z = f
c.v = k
j.v = c
j.x = c
e.p = k
e.o = c
e.u = c
e.r = i
e.w = f
n.v = c
n.x = c
f.p = k
f.r = k
f.o = c
f.u = c
f.w = e
b.v = c
b.x = c
l.v = c
l.x = c
k.w = c
k.t = b
k.s = e
assert k.s.p.s.u.o.r.z.w.txt == "e"