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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.y: F = None
        self.s: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: B = None
        self.s: B = None
        self.x: B = None
        self.z: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: E = None
        self.x: E = None
        self.t: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.y: F = None
        self.s: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: B = None
        self.s: B = None
        self.x: B = None
        self.z: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: E = None
        self.x: E = None
        self.t: D = None
        self.txt = txt

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

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