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

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

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

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

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

j = A("j")
d = B("d")
e = C("e")
m = D("m")
b = E("b")
k = E("k")
l = D("l")

j.p = e
d.u = e
e.w = d
m.s = b
m.u = l
m.x = j
m.o = d
b.r = k
b.s = e
b.x = j
b.y = j
k.r = b
k.s = e
k.x = j
k.y = j
l.s = b
l.u = m
l.x = j
l.o = d
assert d.u.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

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

j = A("j")
d = B("d")
e = C("e")
m = D("m")
b = E("b")
k = E("k")
l = D("l")

j.p = e
d.u = e
e.w = d
m.s = b
m.u = l
m.x = j
m.o = d
b.r = k
b.s = e
b.x = j
b.y = j
k.r = b
k.s = e
k.x = j
k.y = j
l.s = b
l.u = m
l.x = j
l.o = d
assert d.u.w.u.txt == "e"