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

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

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

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

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

d = A("d")
n = B("n")
h = C("h")
c = D("c")
i = E("i")
l = E("l")
a = B("a")

d.y = n
d.s = l
n.v = d
n.w = d
n.x = a
n.z = i
n.r = c
h.t = l
c.p = h
c.w = h
c.y = n
i.u = h
i.v = c
l.u = h
l.v = c
a.v = d
a.w = d
a.x = n
a.z = i
a.r = c
assert i.v.y.v.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: E = None
        self.txt = txt

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

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

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

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

d = A("d")
n = B("n")
h = C("h")
c = D("c")
i = E("i")
l = E("l")
a = B("a")

d.y = n
d.s = l
n.v = d
n.w = d
n.x = a
n.z = i
n.r = c
h.t = l
c.p = h
c.w = h
c.y = n
i.u = h
i.v = c
l.u = h
l.v = c
a.v = d
a.w = d
a.x = n
a.z = i
a.r = c
assert i.v.y.v.s.v.txt == "c"