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

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

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

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

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

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

d.u = g
l.s = i
l.t = e
l.v = m
i.r = b
i.y = g
i.p = d
i.v = d
i.s = l
f.r = b
f.y = c
f.x = l
g.x = c
e.r = g
e.y = i
e.x = m
b.x = i
m.s = c
m.t = e
m.v = a
a.s = i
a.t = f
a.v = l
c.r = g
c.y = b
c.p = d
c.v = d
c.s = l
assert d.u.x.s.v.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

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

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

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

d.u = g
l.s = i
l.t = e
l.v = m
i.r = b
i.y = g
i.p = d
i.v = d
i.s = l
f.r = b
f.y = c
f.x = l
g.x = c
e.r = g
e.y = i
e.x = m
b.x = i
m.s = c
m.t = e
m.v = a
a.s = i
a.t = f
a.v = l
c.r = g
c.y = b
c.p = d
c.v = d
c.s = l
assert d.u.x.s.v.v.s.txt == "i"