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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: E = None
        self.t: B = None
        self.u: E = None
        self.x: B = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
a = C("a")
h = D("h")
b = E("b")
d = F("d")
g = A("g")
m = E("m")

e.v = d
e.s = d
e.x = j
e.p = j
j.o = h
j.t = h
j.z = a
a.x = d
h.z = e
h.q = m
h.t = j
h.x = j
h.u = b
b.x = a
b.u = e
b.v = g
d.u = m
d.p = a
d.v = j
d.t = j
g.v = d
g.s = d
g.x = j
g.p = j
m.x = a
m.u = e
m.v = e
assert h.z.p.z.x.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.x: B = None
        self.p: B = None
        self.s: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: E = None
        self.t: B = None
        self.u: E = None
        self.x: B = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
a = C("a")
h = D("h")
b = E("b")
d = F("d")
g = A("g")
m = E("m")

e.v = d
e.s = d
e.x = j
e.p = j
j.o = h
j.t = h
j.z = a
a.x = d
h.z = e
h.q = m
h.t = j
h.x = j
h.u = b
b.x = a
b.u = e
b.v = g
d.u = m
d.p = a
d.v = j
d.t = j
g.v = d
g.s = d
g.x = j
g.p = j
m.x = a
m.u = e
m.v = e
assert h.z.p.z.x.p.x.txt == "d"