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

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

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

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

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

c = A("c")
e = B("e")
j = C("j")
i = D("i")
l = E("l")
g = B("g")
h = D("h")
k = B("k")
f = B("f")
m = E("m")

c.r = l
e.p = h
e.w = h
e.t = h
e.x = l
e.r = m
j.y = l
j.r = f
j.o = c
j.q = g
i.s = h
i.u = c
l.z = i
g.p = h
g.w = h
g.t = i
g.x = l
g.r = l
h.s = i
h.u = c
k.p = i
k.w = i
k.t = h
k.x = l
k.r = m
f.p = h
f.t = h
f.w = i
f.x = l
f.r = l
m.z = h
assert k.r.z.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

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

c = A("c")
e = B("e")
j = C("j")
i = D("i")
l = E("l")
g = B("g")
h = D("h")
k = B("k")
f = B("f")
m = E("m")

c.r = l
e.p = h
e.w = h
e.t = h
e.x = l
e.r = m
j.y = l
j.r = f
j.o = c
j.q = g
i.s = h
i.u = c
l.z = i
g.p = h
g.w = h
g.t = i
g.x = l
g.r = l
h.s = i
h.u = c
k.p = i
k.w = i
k.t = h
k.x = l
k.r = m
f.p = h
f.t = h
f.w = i
f.x = l
f.r = l
m.z = h
assert k.r.z.s.s.s.txt == "i"