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

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

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: C = None
        self.s: E = None
        self.txt = txt

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

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

k.u = l
k.w = l
j.q = b
j.s = n
j.u = n
n.v = i
n.q = j
i.z = b
i.s = b
i.u = n
b.w = n
l.u = k
l.w = k
assert n.q.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: C = None
        self.s: E = None
        self.txt = txt

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

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

k.u = l
k.w = l
j.q = b
j.s = n
j.u = n
n.v = i
n.q = j
i.z = b
i.s = b
i.u = n
b.w = n
l.u = k
l.w = k
assert n.q.q.w.txt == "n"