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

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

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

b = A("b")
j = B("j")
k = C("k")
h = A("h")
c = A("c")
i = A("i")
n = C("n")

b.t = j
b.o = k
j.x = k
k.q = j
k.t = j
h.t = j
h.o = k
c.t = j
c.o = k
i.t = j
i.o = n
n.q = j
n.t = j
assert k.q.x.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: C = None
        self.txt = txt

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

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

b = A("b")
j = B("j")
k = C("k")
h = A("h")
c = A("c")
i = A("i")
n = C("n")

b.t = j
b.o = k
j.x = k
k.q = j
k.t = j
h.t = j
h.o = k
c.t = j
c.o = k
i.t = j
i.o = n
n.q = j
n.t = j
assert k.q.x.q.x.txt == "k"