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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: E = None
        self.w: D = None
        self.u: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: C = None
        self.p: B = None
        self.r: E = None
        self.s: E = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: E = None
        self.w: D = None
        self.u: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: C = None
        self.p: B = None
        self.r: E = None
        self.s: E = None
        self.txt = txt

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

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

i.x = c
j.q = i
j.x = l
j.w = m
j.u = m
a.w = i
a.r = i
a.q = f
a.z = j
k.t = l
k.u = h
k.p = j
k.r = n
k.s = n
l.y = f
l.v = i
l.p = a
c.x = i
m.t = n
m.u = a
m.p = f
m.r = l
m.s = l
h.w = c
h.q = f
h.z = j
h.r = i
n.y = f
n.v = c
n.p = h
f.q = i
f.x = l
f.w = k
f.u = k
assert n.p.q.q.x.x.x.txt == "c"