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

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

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

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

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

d = A("d")
i = B("i")
g = C("g")
e = D("e")
c = E("c")
h = B("h")

d.r = c
d.v = c
d.y = e
d.z = e
d.w = g
i.y = d
i.q = d
i.s = c
i.o = h
g.o = d
g.y = d
g.p = i
e.x = h
e.o = c
e.z = g
e.y = g
c.q = d
c.z = h
h.y = d
h.q = d
h.s = c
h.o = i
assert e.x.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: D = None
        self.v: E = None
        self.w: C = None
        self.z: D = None
        self.txt = txt

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

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

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

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

d = A("d")
i = B("i")
g = C("g")
e = D("e")
c = E("c")
h = B("h")

d.r = c
d.v = c
d.y = e
d.z = e
d.w = g
i.y = d
i.q = d
i.s = c
i.o = h
g.o = d
g.y = d
g.p = i
e.x = h
e.o = c
e.z = g
e.y = g
c.q = d
c.z = h
h.y = d
h.q = d
h.s = c
h.o = i
assert e.x.s.z.txt == "h"