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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: G = None
        self.v: D = None
        self.u: E = None
        self.r: D = None
        self.w: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: A = None
        self.w: C = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: G = None
        self.v: D = None
        self.u: E = None
        self.r: D = None
        self.w: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: A = None
        self.w: C = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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