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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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