class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: E = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: A = None
        self.txt = txt

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

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

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

m = A("m")
i = B("i")
d = C("d")
j = D("j")
f = E("f")
g = A("g")
c = A("c")
a = C("a")
n = E("n")

m.p = i
m.w = f
m.o = g
i.y = m
i.u = m
d.q = a
d.x = m
d.s = f
d.w = j
j.v = m
j.t = n
j.w = i
j.s = i
f.s = i
g.p = i
g.w = f
g.o = c
c.p = i
c.w = n
c.o = m
a.q = d
a.x = c
a.s = f
a.w = j
n.s = i
assert m.p.y.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: E = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: A = None
        self.txt = txt

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

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

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

m = A("m")
i = B("i")
d = C("d")
j = D("j")
f = E("f")
g = A("g")
c = A("c")
a = C("a")
n = E("n")

m.p = i
m.w = f
m.o = g
i.y = m
i.u = m
d.q = a
d.x = m
d.s = f
d.w = j
j.v = m
j.t = n
j.w = i
j.s = i
f.s = i
g.p = i
g.w = f
g.o = c
c.p = i
c.w = n
c.o = m
a.q = d
a.x = c
a.s = f
a.w = j
n.s = i
assert m.p.y.p.u.txt == "m"