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

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

class C:
    def __init__(self, txt: str):
        self.u: G = None
        self.p: A = None
        self.v: D = None
        self.q: E = None
        self.txt = txt

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

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

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

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

j = A("j")
g = B("g")
n = C("n")
e = D("e")
k = E("k")
l = F("l")
i = G("i")
h = F("h")

j.z = g
g.r = n
g.p = e
n.u = i
n.p = j
n.v = e
n.q = k
e.q = n
k.t = j
k.q = e
k.r = e
k.s = i
k.z = i
k.v = l
l.q = n
l.u = e
i.y = j
h.q = n
h.u = e
assert k.t.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: G = None
        self.p: A = None
        self.v: D = None
        self.q: E = None
        self.txt = txt

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

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

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

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

j = A("j")
g = B("g")
n = C("n")
e = D("e")
k = E("k")
l = F("l")
i = G("i")
h = F("h")

j.z = g
g.r = n
g.p = e
n.u = i
n.p = j
n.v = e
n.q = k
e.q = n
k.t = j
k.q = e
k.r = e
k.s = i
k.z = i
k.v = l
l.q = n
l.u = e
i.y = j
h.q = n
h.u = e
assert k.t.z.p.txt == "e"