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

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

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

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

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

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

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

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

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

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

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

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

i.y = k
i.q = f
n.u = l
n.x = k
f.z = l
f.x = l
f.v = n
l.v = k
l.z = k
l.t = k
l.x = i
l.y = n
k.q = l
assert l.z.q.x.q.v.txt == "n"