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

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

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

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

h.v = d
h.o = d
h.q = a
k.z = h
k.u = h
j.p = h
j.y = h
j.t = l
l.p = h
l.y = h
l.t = j
c.v = h
c.o = h
c.q = k
d.v = c
d.q = k
d.o = h
a.z = d
a.u = d
assert a.u.q.u.q.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.q: B = None
        self.o: A = None
        self.txt = txt

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

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

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

h.v = d
h.o = d
h.q = a
k.z = h
k.u = h
j.p = h
j.y = h
j.t = l
l.p = h
l.y = h
l.t = j
c.v = h
c.o = h
c.q = k
d.v = c
d.q = k
d.o = h
a.z = d
a.u = d
assert a.u.q.u.q.z.v.txt == "c"