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

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

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

i = A("i")
k = B("k")
e = C("e")
f = B("f")
n = A("n")
g = B("g")
j = C("j")

i.o = k
k.q = f
k.x = f
k.o = i
e.w = k
e.o = k
e.p = g
f.q = g
f.o = i
f.x = k
n.o = k
g.q = k
g.o = n
g.x = f
j.w = k
j.p = g
j.o = f
assert i.o.x.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

i = A("i")
k = B("k")
e = C("e")
f = B("f")
n = A("n")
g = B("g")
j = C("j")

i.o = k
k.q = f
k.x = f
k.o = i
e.w = k
e.o = k
e.p = g
f.q = g
f.o = i
f.x = k
n.o = k
g.q = k
g.o = n
g.x = f
j.w = k
j.p = g
j.o = f
assert i.o.x.q.o.txt == "n"