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

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

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

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

g.v = h
g.t = h
l.r = i
a.q = n
a.w = n
a.t = i
n.q = a
n.w = a
n.t = l
i.r = l
d.q = f
d.w = a
d.t = i
f.q = a
f.w = a
f.t = i
h.v = g
h.t = g
assert l.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.t: A = None
        self.txt = txt

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

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

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

g.v = h
g.t = h
l.r = i
a.q = n
a.w = n
a.t = i
n.q = a
n.w = a
n.t = l
i.r = l
d.q = f
d.w = a
d.t = i
f.q = a
f.w = a
f.t = i
h.v = g
h.t = g
assert l.r.r.r.r.r.txt == "i"