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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: D = None
        self.w: A = None
        self.s: A = None
        self.v: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: D = None
        self.s: E = None
        self.r: C = None
        self.o: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: D = None
        self.w: A = None
        self.s: A = None
        self.v: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: D = None
        self.s: E = None
        self.r: C = None
        self.o: D = None
        self.txt = txt

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

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