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

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

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

k = A("k")
e = B("e")
h = C("h")
l = C("l")
c = A("c")
j = B("j")
i = B("i")
f = C("f")

k.o = e
k.v = c
e.q = k
e.r = j
h.z = c
h.q = f
h.o = i
l.z = k
l.q = f
l.o = j
c.o = e
c.v = k
j.q = c
j.r = i
i.q = c
i.r = j
f.z = k
f.q = l
f.o = j
assert l.q.q.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: A = None
        self.txt = txt

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

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

k = A("k")
e = B("e")
h = C("h")
l = C("l")
c = A("c")
j = B("j")
i = B("i")
f = C("f")

k.o = e
k.v = c
e.q = k
e.r = j
h.z = c
h.q = f
h.o = i
l.z = k
l.q = f
l.o = j
c.o = e
c.v = k
j.q = c
j.r = i
i.q = c
i.r = j
f.z = k
f.q = l
f.o = j
assert l.q.q.o.r.txt == "i"