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

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

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.u: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: D = None
        self.z: G = None
        self.r: G = None
        self.q: C = None
        self.u: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: A = None
        self.r: C = None
        self.o: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.u: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: D = None
        self.z: G = None
        self.r: G = None
        self.q: C = None
        self.u: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: A = None
        self.r: C = None
        self.o: D = None
        self.txt = txt

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

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