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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: C = None
        self.p: E = None
        self.z: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: C = None
        self.u: B = None
        self.q: A = None
        self.z: D = None
        self.txt = txt

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

h = A("h")
i = B("i")
b = C("b")
g = D("g")
f = E("f")
e = E("e")
a = D("a")

h.o = e
i.x = b
i.r = b
i.p = e
i.z = h
b.s = e
b.q = i
b.o = i
b.u = i
g.o = e
g.p = b
g.u = i
g.q = h
g.z = a
f.r = e
f.y = e
f.z = i
e.r = f
e.y = f
e.z = i
a.o = e
a.p = b
a.u = i
a.q = h
a.z = g
assert g.p.s.r.y.y.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: C = None
        self.p: E = None
        self.z: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: C = None
        self.u: B = None
        self.q: A = None
        self.z: D = None
        self.txt = txt

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

h = A("h")
i = B("i")
b = C("b")
g = D("g")
f = E("f")
e = E("e")
a = D("a")

h.o = e
i.x = b
i.r = b
i.p = e
i.z = h
b.s = e
b.q = i
b.o = i
b.u = i
g.o = e
g.p = b
g.u = i
g.q = h
g.z = a
f.r = e
f.y = e
f.z = i
e.r = f
e.y = f
e.z = i
a.o = e
a.p = b
a.u = i
a.q = h
a.z = g
assert g.p.s.r.y.y.r.z.txt == "i"