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

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

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

d = A("d")
a = B("a")
f = C("f")
g = A("g")
h = C("h")
l = A("l")
b = A("b")
j = A("j")
k = B("k")
i = C("i")

d.u = l
a.v = i
a.q = f
a.z = f
f.v = d
f.s = k
g.u = j
h.v = j
h.s = a
l.u = b
b.u = l
j.u = b
k.v = f
k.q = f
k.z = i
i.v = d
i.s = k
assert k.q.v.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

d = A("d")
a = B("a")
f = C("f")
g = A("g")
h = C("h")
l = A("l")
b = A("b")
j = A("j")
k = B("k")
i = C("i")

d.u = l
a.v = i
a.q = f
a.z = f
f.v = d
f.s = k
g.u = j
h.v = j
h.s = a
l.u = b
b.u = l
j.u = b
k.v = f
k.q = f
k.z = i
i.v = d
i.s = k
assert k.q.v.u.u.u.u.txt == "b"