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

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

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

e = A("e")
c = B("c")
a = C("a")
b = B("b")
g = B("g")
l = B("l")

e.v = b
c.q = e
c.w = a
a.q = b
a.v = c
b.q = e
b.w = a
g.q = e
g.w = a
l.q = e
l.w = a
assert c.q.v.q.v.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

e = A("e")
c = B("c")
a = C("a")
b = B("b")
g = B("g")
l = B("l")

e.v = b
c.q = e
c.w = a
a.q = b
a.v = c
b.q = e
b.w = a
g.q = e
g.w = a
l.q = e
l.w = a
assert c.q.v.q.v.q.v.txt == "b"