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

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

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

j = A("j")
n = B("n")
k = C("k")
c = C("c")
g = B("g")
f = A("f")
l = A("l")
m = C("m")
b = C("b")
i = B("i")

j.q = i
j.p = i
n.y = k
n.p = j
n.t = b
k.x = l
c.x = l
g.y = m
g.t = m
g.p = l
f.q = g
f.p = i
l.q = i
l.p = g
m.x = j
b.x = l
i.y = k
i.p = l
i.t = m
assert b.x.p.t.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: B = None
        self.txt = txt

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

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

j = A("j")
n = B("n")
k = C("k")
c = C("c")
g = B("g")
f = A("f")
l = A("l")
m = C("m")
b = C("b")
i = B("i")

j.q = i
j.p = i
n.y = k
n.p = j
n.t = b
k.x = l
c.x = l
g.y = m
g.t = m
g.p = l
f.q = g
f.p = i
l.q = i
l.p = g
m.x = j
b.x = l
i.y = k
i.p = l
i.t = m
assert b.x.p.t.x.q.txt == "i"