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

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

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

e = A("e")
m = B("m")
h = C("h")
c = A("c")
g = C("g")
i = C("i")
l = A("l")
f = B("f")
k = B("k")

e.r = m
e.t = g
m.q = h
m.w = k
m.v = c
h.z = l
c.r = m
c.t = i
g.z = e
i.z = l
l.r = f
l.t = h
f.q = h
f.w = k
f.v = l
k.q = i
k.w = f
k.v = l
assert e.r.q.z.t.z.r.v.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: C = None
        self.txt = txt

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

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

e = A("e")
m = B("m")
h = C("h")
c = A("c")
g = C("g")
i = C("i")
l = A("l")
f = B("f")
k = B("k")

e.r = m
e.t = g
m.q = h
m.w = k
m.v = c
h.z = l
c.r = m
c.t = i
g.z = e
i.z = l
l.r = f
l.t = h
f.q = h
f.w = k
f.v = l
k.q = i
k.w = f
k.v = l
assert e.r.q.z.t.z.r.v.t.z.txt == "l"