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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: D = None
        self.x: D = None
        self.p: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: C = None
        self.u: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: C = None
        self.z: F = None
        self.v: A = None
        self.y: D = None
        self.r: B = None
        self.txt = txt

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

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

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

e.s = g
i.r = e
d.w = e
d.u = j
d.x = j
d.p = c
j.p = n
j.y = d
j.u = d
g.s = j
g.y = j
g.p = d
g.z = c
g.v = e
g.r = i
c.r = i
c.y = d
n.v = e
assert j.u.x.p.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: D = None
        self.x: D = None
        self.p: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: C = None
        self.u: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: C = None
        self.z: F = None
        self.v: A = None
        self.y: D = None
        self.r: B = None
        self.txt = txt

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

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

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

e.s = g
i.r = e
d.w = e
d.u = j
d.x = j
d.p = c
j.p = n
j.y = d
j.u = d
g.s = j
g.y = j
g.p = d
g.z = c
g.v = e
g.r = i
c.r = i
c.y = d
n.v = e
assert j.u.x.p.v.s.txt == "g"