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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: B = None
        self.q: D = None
        self.p: C = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: B = None
        self.q: D = None
        self.p: C = None
        self.v: D = None
        self.txt = txt

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

m.y = l
b.x = n
b.z = n
b.r = f
b.p = l
e.w = c
f.s = d
f.z = n
f.x = c
f.q = k
c.z = n
c.u = k
c.q = d
c.p = e
c.v = f
d.s = f
d.z = n
d.x = c
d.q = k
k.x = n
k.z = n
k.r = f
k.p = m
n.z = c
n.u = b
n.q = d
n.v = d
n.p = e
a.w = c
l.y = m
assert c.p.w.u.p.y.y.y.y.txt == "m"