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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: D = None
        self.txt = txt

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

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

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

b = A("b")
m = B("m")
f = C("f")
h = D("h")
a = E("a")
j = F("j")
n = C("n")
d = F("d")

b.q = a
m.v = a
m.y = a
m.o = b
f.p = b
f.w = h
h.v = b
h.w = b
h.r = n
h.z = n
h.p = d
h.q = j
a.o = f
a.q = h
a.x = h
a.w = m
j.r = h
j.o = a
j.y = a
j.v = f
j.q = m
n.p = b
n.w = h
d.r = h
d.o = a
d.y = a
d.v = f
d.q = m
assert m.v.w.o.q.w.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: D = None
        self.txt = txt

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

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

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

b = A("b")
m = B("m")
f = C("f")
h = D("h")
a = E("a")
j = F("j")
n = C("n")
d = F("d")

b.q = a
m.v = a
m.y = a
m.o = b
f.p = b
f.w = h
h.v = b
h.w = b
h.r = n
h.z = n
h.p = d
h.q = j
a.o = f
a.q = h
a.x = h
a.w = m
j.r = h
j.o = a
j.y = a
j.v = f
j.q = m
n.p = b
n.w = h
d.r = h
d.o = a
d.y = a
d.v = f
d.q = m
assert m.v.w.o.q.w.o.q.txt == "a"