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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: C = None
        self.t: D = None
        self.o: E = None
        self.u: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: F = None
        self.u: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: G = None
        self.s: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: C = None
        self.t: D = None
        self.o: E = None
        self.u: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: F = None
        self.u: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: G = None
        self.s: A = None
        self.txt = txt

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

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

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