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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: A = None
        self.x: C = None
        self.txt = txt

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

k.q = d
b.s = a
b.v = d
l.o = f
l.w = j
l.x = d
a.s = c
a.v = l
f.q = l
h.s = b
h.v = d
g.q = d
c.s = h
c.v = d
j.q = l
d.o = k
d.w = k
d.x = l
assert j.q.x.o.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: A = None
        self.x: C = None
        self.txt = txt

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

k.q = d
b.s = a
b.v = d
l.o = f
l.w = j
l.x = d
a.s = c
a.v = l
f.q = l
h.s = b
h.v = d
g.q = d
c.s = h
c.v = d
j.q = l
d.o = k
d.w = k
d.x = l
assert j.q.x.o.q.x.txt == "l"