class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: E = None
        self.u: E = None
        self.z: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: F = None
        self.q: B = None
        self.u: B = None
        self.o: A = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: F = None
        self.q: B = None
        self.u: B = None
        self.o: A = None
        self.txt = txt

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

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

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

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

h.w = m
h.z = m
h.o = n
h.u = n
b.r = m
b.x = m
b.p = h
b.v = d
d.p = m
d.s = g
d.q = b
d.u = f
d.o = h
m.p = a
m.v = b
m.o = g
n.q = d
n.p = m
a.z = g
a.w = h
f.r = m
f.x = m
f.p = h
f.v = d
l.z = a
l.w = h
g.z = l
g.w = h
c.p = m
c.s = l
c.q = f
c.u = f
c.o = h
assert m.p.z.w.o.q.q.txt == "b"