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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: B = None
        self.s: A = None
        self.u: C = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: A = None
        self.q: C = None
        self.p: E = None
        self.txt = txt

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

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

d.p = c
c.w = d
c.s = d
c.y = j
c.u = b
c.p = n
h.q = b
h.v = j
h.x = n
h.p = d
g.w = b
g.y = d
g.q = h
g.p = n
n.o = d
n.v = h
n.q = g
b.q = h
b.v = j
b.x = n
b.p = d
j.w = d
j.s = d
j.y = c
j.u = b
j.p = n
assert h.x.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: B = None
        self.s: A = None
        self.u: C = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: A = None
        self.q: C = None
        self.p: E = None
        self.txt = txt

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

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

d.p = c
c.w = d
c.s = d
c.y = j
c.u = b
c.p = n
h.q = b
h.v = j
h.x = n
h.p = d
g.w = b
g.y = d
g.q = h
g.p = n
n.o = d
n.v = h
n.q = g
b.q = h
b.v = j
b.x = n
b.p = d
j.w = d
j.s = d
j.y = c
j.u = b
j.p = n
assert h.x.q.p.txt == "n"