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

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

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

b = A("b")
l = B("l")
a = C("a")
j = A("j")
f = C("f")
g = B("g")
m = C("m")
k = B("k")

b.z = k
b.x = j
l.z = f
l.t = b
l.u = k
a.r = m
a.q = j
a.o = k
j.z = g
j.x = b
f.r = a
f.q = b
f.o = k
g.z = a
g.t = j
g.u = k
m.r = f
m.q = b
m.o = g
k.z = a
k.t = b
k.u = l
assert k.z.r.r.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: A = None
        self.txt = txt

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

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

b = A("b")
l = B("l")
a = C("a")
j = A("j")
f = C("f")
g = B("g")
m = C("m")
k = B("k")

b.z = k
b.x = j
l.z = f
l.t = b
l.u = k
a.r = m
a.q = j
a.o = k
j.z = g
j.x = b
f.r = a
f.q = b
f.o = k
g.z = a
g.t = j
g.u = k
m.r = f
m.q = b
m.o = g
k.z = a
k.t = b
k.u = l
assert k.z.r.r.r.q.txt == "j"