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

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

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

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

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

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

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

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

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

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

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

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

d.x = n
f.q = j
c.u = d
c.q = n
n.q = f
n.x = j
n.w = j
n.t = c
n.v = d
e.w = f
e.p = f
h.q = e
i.u = d
i.q = n
g.q = e
j.w = f
j.p = g
assert i.q.q.q.p.txt == "g"