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

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

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

h = A("h")
j = B("j")
g = C("g")
e = C("e")
l = A("l")
a = A("a")
f = C("f")
n = C("n")
c = B("c")

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

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

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

h = A("h")
j = B("j")
g = C("g")
e = C("e")
l = A("l")
a = A("a")
f = C("f")
n = C("n")
c = B("c")

h.x = l
h.q = j
h.t = j
j.o = c
g.x = n
g.y = j
e.x = f
e.y = c
l.x = a
l.q = c
l.t = c
a.x = h
a.q = j
a.t = j
f.x = g
f.y = c
n.x = g
n.y = j
c.o = j
assert l.q.o.o.o.o.o.txt == "j"