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

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

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

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

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

d = A("d")
h = B("h")
j = C("j")
g = D("g")
k = E("k")
n = E("n")
i = D("i")

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

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

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

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

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

d = A("d")
h = B("h")
j = C("j")
g = D("g")
k = E("k")
n = E("n")
i = D("i")

d.x = k
d.o = k
d.y = j
h.r = n
h.u = d
h.w = k
h.x = g
j.s = k
j.o = g
j.w = d
j.v = h
g.y = k
g.s = k
g.r = d
g.u = h
k.z = j
n.z = j
i.y = k
i.s = n
i.r = d
i.u = h
assert d.x.z.o.r.o.z.txt == "j"