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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: E = None
        self.q: F = None
        self.t: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.o: E = None
        self.t: E = None
        self.w: B = None
        self.v: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: D = None
        self.s: B = None
        self.u: A = None
        self.y: E = None
        self.v: A = None
        self.txt = txt

b = A("b")
c = B("c")
k = C("k")
m = D("m")
l = E("l")
f = F("f")
g = A("g")
d = C("d")
h = E("h")

b.r = c
b.q = c
c.w = h
c.s = h
c.q = f
c.t = f
k.o = m
k.t = b
m.z = l
m.t = l
m.o = h
m.w = c
m.v = f
l.w = b
l.q = m
l.p = d
l.r = c
f.o = c
f.s = c
f.z = m
f.u = g
f.v = g
f.y = l
g.r = c
g.q = c
d.o = m
d.t = g
h.w = g
h.q = m
h.p = d
h.r = c
assert d.o.v.o.q.o.w.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: E = None
        self.q: F = None
        self.t: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.o: E = None
        self.t: E = None
        self.w: B = None
        self.v: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: D = None
        self.s: B = None
        self.u: A = None
        self.y: E = None
        self.v: A = None
        self.txt = txt

b = A("b")
c = B("c")
k = C("k")
m = D("m")
l = E("l")
f = F("f")
g = A("g")
d = C("d")
h = E("h")

b.r = c
b.q = c
c.w = h
c.s = h
c.q = f
c.t = f
k.o = m
k.t = b
m.z = l
m.t = l
m.o = h
m.w = c
m.v = f
l.w = b
l.q = m
l.p = d
l.r = c
f.o = c
f.s = c
f.z = m
f.u = g
f.v = g
f.y = l
g.r = c
g.q = c
d.o = m
d.t = g
h.w = g
h.q = m
h.p = d
h.r = c
assert d.o.v.o.q.o.w.q.w.txt == "c"