class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: D = None
        self.v: A = None
        self.q: D = None
        self.o: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: B = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: C = None
        self.v: B = None
        self.u: E = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: C = None
        self.u: C = None
        self.t: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: A = None
        self.p: A = None
        self.txt = txt

j = A("j")
h = B("h")
a = C("a")
d = D("d")
m = E("m")
g = F("g")
i = A("i")

j.r = a
j.x = d
j.q = d
j.v = i
j.o = g
h.r = m
h.v = j
a.t = g
a.v = h
a.p = d
d.x = a
d.q = a
d.v = h
d.w = h
d.u = m
m.r = d
m.t = d
m.q = a
m.u = a
g.w = m
g.s = j
g.p = i
i.r = a
i.x = d
i.q = d
i.v = j
i.o = g
assert m.q.p.v.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: D = None
        self.v: A = None
        self.q: D = None
        self.o: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: B = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: C = None
        self.v: B = None
        self.u: E = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: C = None
        self.u: C = None
        self.t: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: A = None
        self.p: A = None
        self.txt = txt

j = A("j")
h = B("h")
a = C("a")
d = D("d")
m = E("m")
g = F("g")
i = A("i")

j.r = a
j.x = d
j.q = d
j.v = i
j.o = g
h.r = m
h.v = j
a.t = g
a.v = h
a.p = d
d.x = a
d.q = a
d.v = h
d.w = h
d.u = m
m.r = d
m.t = d
m.q = a
m.u = a
g.w = m
g.s = j
g.p = i
i.r = a
i.x = d
i.q = d
i.v = j
i.o = g
assert m.q.p.v.r.q.txt == "a"