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

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

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

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

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

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

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

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

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

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

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

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

f.q = k
f.s = n
b.p = k
k.v = i
k.y = f
k.t = f
k.s = b
e.t = k
n.z = e
n.x = k
i.t = k
assert n.z.t.t.s.z.txt == "e"