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

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

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

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

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

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

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

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

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

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

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

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

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