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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.s: D = None
        self.p: F = None
        self.t: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.p: A = None
        self.r: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.s: D = None
        self.p: F = None
        self.t: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.p: A = None
        self.r: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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