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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: A = None
        self.p: E = None
        self.q: D = None
        self.r: E = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: F = None
        self.t: G = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: A = None
        self.p: E = None
        self.q: D = None
        self.r: E = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: F = None
        self.t: G = None
        self.txt = txt

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

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

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

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

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

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