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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: F = None
        self.x: G = None
        self.p: A = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: D = None
        self.p: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: F = None
        self.x: G = None
        self.p: A = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: D = None
        self.p: A = None
        self.txt = txt

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

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