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

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.x: G = None
        self.o: E = None
        self.s: C = None
        self.q: C = None
        self.r: F = None
        self.txt = txt

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

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

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

c = A("c")
n = B("n")
e = C("e")
f = D("f")
j = E("j")
i = F("i")
m = G("m")
g = G("g")

c.r = f
n.y = f
e.p = n
e.v = j
f.u = g
f.x = m
f.o = j
f.s = e
f.q = e
f.r = i
j.r = f
i.p = n
i.w = e
m.s = n
g.s = n
assert m.s.y.u.s.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.x: G = None
        self.o: E = None
        self.s: C = None
        self.q: C = None
        self.r: F = None
        self.txt = txt

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

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

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

c = A("c")
n = B("n")
e = C("e")
f = D("f")
j = E("j")
i = F("i")
m = G("m")
g = G("g")

c.r = f
n.y = f
e.p = n
e.v = j
f.u = g
f.x = m
f.o = j
f.s = e
f.q = e
f.r = i
j.r = f
i.p = n
i.w = e
m.s = n
g.s = n
assert m.s.y.u.s.y.s.txt == "e"