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

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

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

h = A("h")
n = B("n")
i = C("i")
l = C("l")
a = B("a")
f = C("f")
d = C("d")
j = B("j")
c = A("c")

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

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

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

h = A("h")
n = B("n")
i = C("i")
l = C("l")
a = B("a")
f = C("f")
d = C("d")
j = B("j")
c = A("c")

h.r = c
h.q = a
h.o = n
n.s = d
n.t = a
i.q = d
i.y = d
l.q = f
l.y = d
a.s = f
a.t = n
f.q = i
f.y = d
d.q = l
d.y = l
j.s = f
j.t = n
c.r = h
c.q = a
c.o = n
assert j.s.q.y.q.q.y.txt == "d"