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

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

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

l = A("l")
h = B("h")
i = C("i")
d = D("d")
g = E("g")
c = B("c")
f = B("f")
a = B("a")

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

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

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

l = A("l")
h = B("h")
i = C("i")
d = D("d")
g = E("g")
c = B("c")
f = B("f")
a = B("a")

l.z = g
l.s = i
l.p = d
h.w = l
h.s = l
h.v = d
h.z = i
h.x = g
i.q = l
i.u = g
i.z = a
d.v = c
g.w = d
g.t = l
g.r = i
c.w = l
c.s = l
c.v = d
c.z = i
c.x = g
f.w = l
f.s = l
f.v = d
f.z = i
f.x = g
a.w = l
a.s = l
a.v = d
a.z = i
a.x = g
assert g.r.z.z.txt == "i"