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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: D = None
        self.y: D = None
        self.t: E = None
        self.u: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: D = None
        self.y: D = None
        self.t: E = None
        self.u: C = None
        self.txt = txt

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

n.w = m
k.q = f
k.t = i
d.r = m
d.v = m
d.z = k
d.x = b
a.o = f
a.x = n
a.r = k
a.y = k
b.s = d
b.u = d
b.x = a
b.y = a
b.t = f
f.s = d
f.u = d
f.x = a
f.y = a
f.t = b
i.o = b
i.x = h
i.r = l
i.y = k
m.r = d
m.v = d
m.z = k
m.x = f
l.q = f
l.t = a
h.w = d
assert h.w.z.q.txt == "f"