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

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

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

h = A("h")
f = B("f")
a = C("a")
e = B("e")
d = B("d")
l = C("l")
g = C("g")
i = B("i")
c = A("c")

h.s = c
h.t = c
f.z = h
f.p = c
f.q = a
a.w = l
a.o = h
a.r = c
e.z = h
e.p = c
e.q = l
d.z = c
d.p = h
d.q = l
l.w = a
l.o = h
l.r = c
g.w = l
g.o = c
g.r = h
i.z = h
i.p = c
i.q = l
c.s = h
c.t = h
assert c.t.s.s.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: A = None
        self.txt = txt

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

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

h = A("h")
f = B("f")
a = C("a")
e = B("e")
d = B("d")
l = C("l")
g = C("g")
i = B("i")
c = A("c")

h.s = c
h.t = c
f.z = h
f.p = c
f.q = a
a.w = l
a.o = h
a.r = c
e.z = h
e.p = c
e.q = l
d.z = c
d.p = h
d.q = l
l.w = a
l.o = h
l.r = c
g.w = l
g.o = c
g.r = h
i.z = h
i.p = c
i.q = l
c.s = h
c.t = h
assert c.t.s.s.s.t.s.txt == "c"