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

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

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

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

g.z = d
g.q = f
d.w = f
d.t = g
h.y = n
n.w = h
n.t = g
f.y = n
e.y = d
c.z = n
c.q = e
l.z = d
l.q = f
assert e.y.w.y.w.y.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: C = None
        self.txt = txt

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

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

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

g.z = d
g.q = f
d.w = f
d.t = g
h.y = n
n.w = h
n.t = g
f.y = n
e.y = d
c.z = n
c.q = e
l.z = d
l.q = f
assert e.y.w.y.w.y.t.q.txt == "f"