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

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

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

m = A("m")
d = B("d")
l = C("l")
e = C("e")
g = A("g")
n = C("n")
k = B("k")

m.t = n
m.v = g
d.z = g
d.p = k
l.w = k
l.r = e
l.t = n
e.w = d
e.r = l
e.t = n
g.t = l
g.v = m
n.w = k
n.r = l
n.t = l
k.z = g
k.p = d
assert g.t.r.w.z.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: A = None
        self.txt = txt

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

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

m = A("m")
d = B("d")
l = C("l")
e = C("e")
g = A("g")
n = C("n")
k = B("k")

m.t = n
m.v = g
d.z = g
d.p = k
l.w = k
l.r = e
l.t = n
e.w = d
e.r = l
e.t = n
g.t = l
g.v = m
n.w = k
n.r = l
n.t = l
k.z = g
k.p = d
assert g.t.r.w.z.t.t.t.txt == "l"