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

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

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

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

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

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

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

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

m.v = e
m.q = j
a.t = j
a.r = m
c.y = j
c.w = j
d.v = e
d.q = e
e.y = j
e.w = j
g.v = e
g.q = e
j.y = c
j.w = e
n.t = c
n.r = g
assert d.v.w.y.w.y.txt == "c"