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

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

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

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

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

n = A("n")
j = B("j")
k = C("k")
b = D("b")
l = E("l")
f = C("f")

n.u = l
n.v = l
j.w = n
j.v = n
j.x = n
j.s = n
k.q = j
b.u = f
b.y = n
l.s = b
l.o = b
l.t = j
l.w = j
l.r = f
f.q = j
assert k.q.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: E = None
        self.txt = txt

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

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

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

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

n = A("n")
j = B("j")
k = C("k")
b = D("b")
l = E("l")
f = C("f")

n.u = l
n.v = l
j.w = n
j.v = n
j.x = n
j.s = n
k.q = j
b.u = f
b.y = n
l.s = b
l.o = b
l.t = j
l.w = j
l.r = f
f.q = j
assert k.q.x.u.txt == "l"