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

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

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

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

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

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

j.u = b
b.r = g
b.y = m
b.t = m
b.o = d
b.x = l
g.v = m
m.v = f
l.w = m
f.u = d
d.r = g
d.y = m
d.t = m
d.o = b
d.x = l
assert l.w.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

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

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

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

j.u = b
b.r = g
b.y = m
b.t = m
b.o = d
b.x = l
g.v = m
m.v = f
l.w = m
f.u = d
d.r = g
d.y = m
d.t = m
d.o = b
d.x = l
assert l.w.v.u.txt == "d"