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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: A = None
        self.v: A = None
        self.z: A = None
        self.w: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: B = None
        self.v: B = None
        self.s: B = None
        self.y: C = None
        self.txt = txt

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

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

k.u = n
k.r = n
k.w = l
k.x = l
k.q = j
n.p = l
n.t = k
n.v = k
n.z = k
n.w = h
j.t = l
j.p = h
l.w = h
l.x = n
l.v = n
l.s = n
l.y = j
h.s = n
assert k.u.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: D = None
        self.r: B = None
        self.q: C = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: A = None
        self.v: A = None
        self.z: A = None
        self.w: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: B = None
        self.v: B = None
        self.s: B = None
        self.y: C = None
        self.txt = txt

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

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

k.u = n
k.r = n
k.w = l
k.x = l
k.q = j
n.p = l
n.t = k
n.v = k
n.z = k
n.w = h
j.t = l
j.p = h
l.w = h
l.x = n
l.v = n
l.s = n
l.y = j
h.s = n
assert k.u.t.u.txt == "n"