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

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

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

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

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

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

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

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

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

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

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