class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: D = None
        self.s: D = None
        self.p: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: B = None
        self.o: C = None
        self.w: C = None
        self.z: D = None
        self.txt = txt

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

n = A("n")
l = B("l")
h = C("h")
c = D("c")
m = E("m")
d = D("d")
f = A("f")

n.q = l
n.r = d
n.s = d
n.p = m
l.q = f
l.s = m
h.z = f
h.v = f
h.y = d
h.t = n
h.p = m
c.r = d
c.z = d
c.s = l
c.o = h
c.w = h
m.o = h
m.v = l
d.r = c
d.z = c
d.s = l
d.o = h
d.w = h
f.q = l
f.r = d
f.s = c
f.p = m
assert c.w.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: D = None
        self.s: D = None
        self.p: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: B = None
        self.o: C = None
        self.w: C = None
        self.z: D = None
        self.txt = txt

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

n = A("n")
l = B("l")
h = C("h")
c = D("c")
m = E("m")
d = D("d")
f = A("f")

n.q = l
n.r = d
n.s = d
n.p = m
l.q = f
l.s = m
h.z = f
h.v = f
h.y = d
h.t = n
h.p = m
c.r = d
c.z = d
c.s = l
c.o = h
c.w = h
m.o = h
m.v = l
d.r = c
d.z = c
d.s = l
d.o = h
d.w = h
f.q = l
f.r = d
f.s = c
f.p = m
assert c.w.t.q.txt == "l"