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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

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

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

m.u = l
m.x = b
m.v = d
b.x = k
l.v = b
l.p = b
l.z = e
l.o = d
d.r = e
d.t = k
e.o = b
k.u = l
k.x = b
k.v = d
assert d.r.o.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: B = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

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

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

m.u = l
m.x = b
m.v = d
b.x = k
l.v = b
l.p = b
l.z = e
l.o = d
d.r = e
d.t = k
e.o = b
k.u = l
k.x = b
k.v = d
assert d.r.o.x.x.x.txt == "k"