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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: C = None
        self.s: E = None
        self.p: C = None
        self.o: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: F = None
        self.w: A = None
        self.y: F = None
        self.u: F = None
        self.s: C = None
        self.p: G = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: C = None
        self.s: E = None
        self.p: C = None
        self.o: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: F = None
        self.w: A = None
        self.y: F = None
        self.u: F = None
        self.s: C = None
        self.p: G = None
        self.txt = txt

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

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

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

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