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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: F = None
        self.y: G = None
        self.q: A = None
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: D = None
        self.q: A = None
        self.y: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: B = None
        self.p: D = None
        self.s: B = None
        self.y: B = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: F = None
        self.y: G = None
        self.q: A = None
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: D = None
        self.q: A = None
        self.y: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: B = None
        self.p: D = None
        self.s: B = None
        self.y: B = None
        self.q: E = None
        self.txt = txt

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

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