class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: E = None
        self.s: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: D = None
        self.t: A = None
        self.y: D = None
        self.r: D = None
        self.txt = txt

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

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

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

k.p = l
k.x = f
k.s = f
n.v = k
n.s = l
l.p = e
l.q = e
l.y = e
l.r = e
l.t = k
e.u = f
e.r = f
e.t = f
f.z = k
f.p = k
f.y = l
f.v = n
assert n.s.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: E = None
        self.s: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: D = None
        self.t: A = None
        self.y: D = None
        self.r: D = None
        self.txt = txt

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

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

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

k.p = l
k.x = f
k.s = f
n.v = k
n.s = l
l.p = e
l.q = e
l.y = e
l.r = e
l.t = k
e.u = f
e.r = f
e.t = f
f.z = k
f.p = k
f.y = l
f.v = n
assert n.s.q.t.txt == "f"