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

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

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

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

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

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

f.r = e
f.q = e
f.p = b
f.s = m
f.x = d
d.z = b
d.p = b
d.x = m
d.s = f
d.r = f
c.v = i
c.r = d
c.z = f
c.o = e
i.s = a
i.q = e
i.p = e
i.z = n
i.w = d
a.o = c
h.s = n
h.q = f
h.z = a
h.w = d
h.p = e
b.v = h
b.r = d
b.z = f
b.o = e
e.r = f
e.q = f
e.p = c
e.s = m
e.x = d
m.s = n
m.q = e
m.z = a
m.w = d
m.p = f
n.o = c
assert i.q.r.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: C = None
        self.q: A = None
        self.s: D = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

f.r = e
f.q = e
f.p = b
f.s = m
f.x = d
d.z = b
d.p = b
d.x = m
d.s = f
d.r = f
c.v = i
c.r = d
c.z = f
c.o = e
i.s = a
i.q = e
i.p = e
i.z = n
i.w = d
a.o = c
h.s = n
h.q = f
h.z = a
h.w = d
h.p = e
b.v = h
b.r = d
b.z = f
b.o = e
e.r = f
e.q = f
e.p = c
e.s = m
e.x = d
m.s = n
m.q = e
m.z = a
m.w = d
m.p = f
n.o = c
assert i.q.r.s.s.txt == "n"