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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: A = None
        self.txt = txt

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

d.w = n
d.y = i
n.u = c
n.v = c
m.u = c
i.t = d
i.x = m
i.w = c
i.u = c
c.o = n
c.s = d
b.u = c
b.v = c
a.u = c
assert i.u.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: A = None
        self.txt = txt

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

d.w = n
d.y = i
n.u = c
n.v = c
m.u = c
i.t = d
i.x = m
i.w = c
i.u = c
c.o = n
c.s = d
b.u = c
b.v = c
a.u = c
assert i.u.o.u.txt == "c"