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

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: B = None
        self.v: B = None
        self.o: B = None
        self.s: B = None
        self.txt = txt

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

j = A("j")
n = B("n")
d = C("d")
m = D("m")
h = E("h")
c = E("c")
i = C("i")

j.v = m
j.w = m
j.s = n
n.t = d
d.q = h
d.w = h
d.y = n
d.t = m
d.u = c
m.x = j
m.w = n
m.v = n
m.o = n
m.s = n
h.z = c
h.x = m
c.z = h
c.x = m
i.q = c
i.w = c
i.u = c
i.y = n
i.t = m
assert j.v.o.t.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: D = None
        self.s: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: B = None
        self.v: B = None
        self.o: B = None
        self.s: B = None
        self.txt = txt

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

j = A("j")
n = B("n")
d = C("d")
m = D("m")
h = E("h")
c = E("c")
i = C("i")

j.v = m
j.w = m
j.s = n
n.t = d
d.q = h
d.w = h
d.y = n
d.t = m
d.u = c
m.x = j
m.w = n
m.v = n
m.o = n
m.s = n
h.z = c
h.x = m
c.z = h
c.x = m
i.q = c
i.w = c
i.u = c
i.y = n
i.t = m
assert j.v.o.t.y.t.txt == "d"