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

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

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

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

n = A("n")
d = B("d")
l = C("l")
b = D("b")
h = D("h")
a = A("a")
c = C("c")
g = D("g")
i = A("i")

n.x = l
n.w = a
n.q = b
n.s = d
d.x = a
d.t = b
l.s = n
b.p = g
b.s = g
b.o = a
h.p = b
h.s = b
h.o = n
a.x = l
a.w = n
a.q = g
a.s = d
c.s = n
g.p = h
g.o = i
g.s = b
i.x = c
i.w = n
i.q = b
i.s = d
assert i.q.o.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: A = None
        self.q: D = None
        self.s: B = None
        self.txt = txt

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

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

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

n = A("n")
d = B("d")
l = C("l")
b = D("b")
h = D("h")
a = A("a")
c = C("c")
g = D("g")
i = A("i")

n.x = l
n.w = a
n.q = b
n.s = d
d.x = a
d.t = b
l.s = n
b.p = g
b.s = g
b.o = a
h.p = b
h.s = b
h.o = n
a.x = l
a.w = n
a.q = g
a.s = d
c.s = n
g.p = h
g.o = i
g.s = b
i.x = c
i.w = n
i.q = b
i.s = d
assert i.q.o.w.x.txt == "l"