class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.y: G = None
        self.s: G = None
        self.o: G = None
        self.u: F = None
        self.w: C = None
        self.z: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.w: G = None
        self.r: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: B = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.w: G = None
        self.r: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: B = None
        self.txt = txt

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

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