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

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

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

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

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

i = A("i")
m = B("m")
g = C("g")
e = D("e")
d = E("d")
k = D("k")
b = C("b")
h = E("h")

i.r = m
i.x = g
m.u = g
g.w = e
g.o = i
g.z = i
g.p = h
g.r = d
e.r = b
e.q = k
d.x = m
d.r = m
d.u = h
d.y = i
k.r = g
k.q = e
b.w = e
b.o = i
b.z = i
b.p = d
b.r = d
h.x = m
h.r = m
h.u = d
h.y = i
assert g.z.x.w.r.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: C = None
        self.txt = txt

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

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

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

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

i = A("i")
m = B("m")
g = C("g")
e = D("e")
d = E("d")
k = D("k")
b = C("b")
h = E("h")

i.r = m
i.x = g
m.u = g
g.w = e
g.o = i
g.z = i
g.p = h
g.r = d
e.r = b
e.q = k
d.x = m
d.r = m
d.u = h
d.y = i
k.r = g
k.q = e
b.w = e
b.o = i
b.z = i
b.p = d
b.r = d
h.x = m
h.r = m
h.u = d
h.y = i
assert g.z.x.w.r.r.y.txt == "i"