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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: B = None
        self.q: A = None
        self.z: D = None
        self.p: A = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: B = None
        self.q: A = None
        self.z: D = None
        self.p: A = None
        self.txt = txt

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

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

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

c.r = n
c.x = f
c.u = m
n.w = b
m.o = n
m.t = n
m.q = c
m.p = c
m.z = b
b.s = c
f.p = n
f.r = n
f.o = m
d.p = n
d.r = n
d.o = m
i.s = c
assert f.p.w.s.u.p.r.w.txt == "b"