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

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

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

e = A("e")
f = B("f")
l = C("l")
b = B("b")
h = A("h")

e.t = h
e.s = l
e.q = f
f.y = b
f.v = l
l.p = h
b.y = f
b.v = l
h.t = e
h.s = l
h.q = f
assert l.p.t.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: C = None
        self.q: B = None
        self.txt = txt

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

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

e = A("e")
f = B("f")
l = C("l")
b = B("b")
h = A("h")

e.t = h
e.s = l
e.q = f
f.y = b
f.v = l
l.p = h
b.y = f
b.v = l
h.t = e
h.s = l
h.q = f
assert l.p.t.q.y.txt == "b"