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

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

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

j = A("j")
a = B("a")
b = C("b")
l = B("l")
h = C("h")
e = A("e")

j.y = b
a.o = j
a.y = h
a.q = l
b.y = l
b.v = h
b.t = h
l.o = e
l.y = h
l.q = a
h.y = l
h.v = b
h.t = b
e.y = h
assert b.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
b = C("b")
l = B("l")
h = C("h")
e = A("e")

j.y = b
a.o = j
a.y = h
a.q = l
b.y = l
b.v = h
b.t = h
l.o = e
l.y = h
l.q = a
h.y = l
h.v = b
h.t = b
e.y = h
assert b.y.y.y.y.y.txt == "l"