class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: B = None
        self.q: B = None
        self.t: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

h.o = k
h.r = d
a.r = e
g.z = a
g.v = a
g.s = n
c.v = a
c.r = a
c.q = a
c.t = e
d.r = a
d.s = k
e.r = g
k.u = h
k.o = c
n.o = k
n.r = d
assert k.u.o.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: B = None
        self.q: B = None
        self.t: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

h.o = k
h.r = d
a.r = e
g.z = a
g.v = a
g.s = n
c.v = a
c.r = a
c.q = a
c.t = e
d.r = a
d.s = k
e.r = g
k.u = h
k.o = c
n.o = k
n.r = d
assert k.u.o.o.t.txt == "e"