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

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

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

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

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

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

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

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

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