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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

i = A("i")
n = B("n")
f = C("f")
a = C("a")
g = B("g")
d = C("d")
k = C("k")
l = B("l")

i.v = g
i.x = n
n.q = i
f.u = l
f.q = k
f.y = a
a.u = l
a.q = k
a.y = k
g.q = i
d.u = l
d.q = f
d.y = f
k.u = n
k.q = d
k.y = d
l.q = i
assert k.u.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

i = A("i")
n = B("n")
f = C("f")
a = C("a")
g = B("g")
d = C("d")
k = C("k")
l = B("l")

i.v = g
i.x = n
n.q = i
f.u = l
f.q = k
f.y = a
a.u = l
a.q = k
a.y = k
g.q = i
d.u = l
d.q = f
d.y = f
k.u = n
k.q = d
k.y = d
l.q = i
assert k.u.q.x.txt == "n"