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

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

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

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

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

b = A("b")
g = B("g")
i = C("i")
f = D("f")
n = E("n")
e = E("e")
d = C("d")

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

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

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

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

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

b = A("b")
g = B("g")
i = C("i")
f = D("f")
n = E("n")
e = E("e")
d = C("d")

b.r = d
b.x = g
b.z = f
b.s = f
b.p = n
g.w = b
g.q = n
g.y = d
i.u = e
i.y = b
i.s = n
f.q = e
f.v = g
n.w = d
n.p = d
n.s = b
e.w = d
e.p = i
e.s = b
d.u = n
d.s = n
d.y = b
assert i.u.s.r.txt == "d"