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

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

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

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

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

n = A("n")
b = B("b")
d = C("d")
a = D("a")
l = E("l")
f = C("f")

n.u = l
n.x = l
n.r = l
b.w = l
b.y = n
d.r = a
d.o = a
d.y = l
a.x = b
a.o = d
l.p = b
l.v = b
f.r = a
f.o = a
f.y = l
assert b.w.v.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: E = None
        self.r: E = None
        self.txt = txt

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

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

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

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

n = A("n")
b = B("b")
d = C("d")
a = D("a")
l = E("l")
f = C("f")

n.u = l
n.x = l
n.r = l
b.w = l
b.y = n
d.r = a
d.o = a
d.y = l
a.x = b
a.o = d
l.p = b
l.v = b
f.r = a
f.o = a
f.y = l
assert b.w.v.y.r.txt == "l"