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

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.t: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: G = None
        self.p: F = None
        self.u: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: B = None
        self.w: E = None
        self.r: E = None
        self.o: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: B = None
        self.o: G = None
        self.t: D = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.t: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: G = None
        self.p: F = None
        self.u: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: B = None
        self.w: E = None
        self.r: E = None
        self.o: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: B = None
        self.o: G = None
        self.t: D = None
        self.txt = txt

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

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

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