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

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

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

m = A("m")
f = B("f")
i = C("i")
g = A("g")
k = B("k")
c = C("c")
h = A("h")
j = C("j")
a = A("a")
l = B("l")

m.o = l
m.q = l
m.x = a
f.z = k
f.o = j
i.y = j
g.o = l
g.q = l
g.x = m
k.z = l
k.o = j
c.y = i
h.o = l
h.q = l
h.x = g
j.y = i
a.o = l
a.x = g
a.q = f
l.z = f
l.o = j
assert c.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.x: A = None
        self.q: B = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
i = C("i")
g = A("g")
k = B("k")
c = C("c")
h = A("h")
j = C("j")
a = A("a")
l = B("l")

m.o = l
m.q = l
m.x = a
f.z = k
f.o = j
i.y = j
g.o = l
g.q = l
g.x = m
k.z = l
k.o = j
c.y = i
h.o = l
h.q = l
h.x = g
j.y = i
a.o = l
a.x = g
a.q = f
l.z = f
l.o = j
assert c.y.y.y.y.txt == "j"