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

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

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

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

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

f = A("f")
c = B("c")
k = C("k")
n = D("n")
h = E("h")

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

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

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

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

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

f = A("f")
c = B("c")
k = C("k")
n = D("n")
h = E("h")

f.y = k
f.x = k
f.v = k
f.s = h
f.z = c
c.x = k
k.q = c
k.v = f
k.p = f
k.u = f
k.x = n
n.z = k
n.r = c
n.x = h
h.x = n
h.w = n
assert n.x.x.r.x.txt == "k"