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

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

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

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

d.v = e
d.r = n
g.q = l
g.t = e
g.s = a
m.y = f
m.q = n
f.y = a
f.q = l
e.v = d
e.r = g
c.q = l
c.t = d
c.s = a
n.q = l
n.t = d
n.s = a
a.y = m
a.q = n
l.q = g
l.t = d
l.s = a
assert a.q.q.q.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: B = None
        self.txt = txt

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

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

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

d.v = e
d.r = n
g.q = l
g.t = e
g.s = a
m.y = f
m.q = n
f.y = a
f.q = l
e.v = d
e.r = g
c.q = l
c.t = d
c.s = a
n.q = l
n.t = d
n.s = a
a.y = m
a.q = n
l.q = g
l.t = d
l.s = a
assert a.q.q.q.t.v.txt == "d"