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

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

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

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

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

a = A("a")
d = B("d")
e = C("e")
j = D("j")
n = E("n")
g = B("g")
b = E("b")
i = C("i")

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

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

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

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

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

a = A("a")
d = B("d")
e = C("e")
j = D("j")
n = E("n")
g = B("g")
b = E("b")
i = C("i")

a.o = i
d.v = a
d.s = a
d.y = g
d.p = j
d.x = j
e.z = j
e.v = i
e.w = n
e.u = a
e.r = b
j.r = b
j.s = e
n.v = e
n.w = b
g.v = a
g.s = a
g.y = d
g.p = j
g.x = j
b.v = i
b.w = n
i.z = j
i.v = e
i.w = b
i.r = b
i.u = a
assert d.y.s.o.z.s.txt == "e"