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

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

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

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

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

k = A("k")
h = B("h")
c = C("c")
n = D("n")
d = E("d")
g = D("g")
e = B("e")
j = A("j")
b = E("b")
f = B("f")

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

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

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

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

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

k = A("k")
h = B("h")
c = C("c")
n = D("n")
d = E("d")
g = D("g")
e = B("e")
j = A("j")
b = E("b")
f = B("f")

k.x = g
k.p = j
k.s = j
k.t = c
h.t = b
h.v = b
h.q = f
h.s = c
c.x = b
c.v = k
n.y = j
n.r = g
n.x = c
d.z = g
d.x = h
d.t = c
d.u = b
d.q = k
g.y = j
g.r = n
g.x = c
e.t = d
e.q = f
e.s = c
e.v = b
j.x = g
j.p = k
j.s = k
j.t = c
b.z = n
b.x = e
b.t = c
b.u = d
b.q = j
f.t = b
f.q = h
f.s = c
f.v = d
assert g.r.x.x.q.x.x.txt == "c"