class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: D = None
        self.s: G = None
        self.z: D = None
        self.p: C = None
        self.v: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: H = None
        self.v: F = None
        self.z: B = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

f = A("f")
l = B("l")
b = C("b")
d = D("d")
m = E("m")
a = F("a")
i = G("i")
e = H("e")
g = B("g")

f.r = l
f.w = d
f.z = d
f.s = i
f.p = b
f.v = e
l.o = f
l.y = f
l.x = b
b.s = g
b.z = g
b.w = e
b.v = a
d.p = a
d.w = a
m.r = g
m.s = i
m.v = i
a.o = f
i.o = m
i.x = b
i.q = f
e.s = f
g.o = f
g.y = f
g.x = b
assert d.p.o.p.v.o.s.q.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: D = None
        self.s: G = None
        self.z: D = None
        self.p: C = None
        self.v: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: H = None
        self.v: F = None
        self.z: B = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

f = A("f")
l = B("l")
b = C("b")
d = D("d")
m = E("m")
a = F("a")
i = G("i")
e = H("e")
g = B("g")

f.r = l
f.w = d
f.z = d
f.s = i
f.p = b
f.v = e
l.o = f
l.y = f
l.x = b
b.s = g
b.z = g
b.w = e
b.v = a
d.p = a
d.w = a
m.r = g
m.s = i
m.v = i
a.o = f
i.o = m
i.x = b
i.q = f
e.s = f
g.o = f
g.y = f
g.x = b
assert d.p.o.p.v.o.s.q.s.q.txt == "f"