class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: D = None
        self.t: D = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: B = None
        self.r: A = None
        self.v: A = None
        self.x: E = None
        self.u: E = None
        self.w: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: B = None
        self.r: A = None
        self.v: A = None
        self.x: E = None
        self.u: E = None
        self.w: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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