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

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

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

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

m.x = g
m.v = l
m.p = k
k.q = e
k.v = n
g.y = b
b.x = g
b.v = l
b.p = d
e.x = g
e.v = k
e.p = k
n.x = g
n.v = l
n.p = d
d.q = m
d.v = e
l.q = m
l.v = m
assert d.v.v.q.x.y.x.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: B = None
        self.p: B = None
        self.txt = txt

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

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

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

m.x = g
m.v = l
m.p = k
k.q = e
k.v = n
g.y = b
b.x = g
b.v = l
b.p = d
e.x = g
e.v = k
e.p = k
n.x = g
n.v = l
n.p = d
d.q = m
d.v = e
l.q = m
l.v = m
assert d.v.v.q.x.y.x.y.x.txt == "g"