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

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

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

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

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

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

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

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

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

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

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

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

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