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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

c.x = m
c.p = l
c.q = f
c.w = b
f.q = m
f.u = b
f.w = b
f.t = c
l.w = d
l.t = d
d.x = b
d.o = f
d.z = l
b.u = d
m.x = c
m.p = l
m.q = f
m.w = b
assert b.u.z.w.txt == "d"