class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: B = None
        self.y: B = None
        self.txt = txt

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

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

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

d = A("d")
n = B("n")
a = C("a")
f = D("f")
h = B("h")
b = C("b")
e = D("e")
j = C("j")
l = D("l")
i = D("i")

d.r = b
d.x = h
d.y = h
n.u = h
n.s = d
n.q = f
a.p = j
a.x = h
f.s = j
f.v = n
f.q = e
f.p = l
h.u = n
h.s = d
h.q = l
b.p = a
b.x = n
e.s = b
e.v = h
e.q = l
e.p = l
j.p = b
j.x = h
l.s = a
l.v = n
l.q = e
l.p = i
i.s = j
i.v = h
i.q = f
i.p = e
assert n.q.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: B = None
        self.y: B = None
        self.txt = txt

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

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

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

d = A("d")
n = B("n")
a = C("a")
f = D("f")
h = B("h")
b = C("b")
e = D("e")
j = C("j")
l = D("l")
i = D("i")

d.r = b
d.x = h
d.y = h
n.u = h
n.s = d
n.q = f
a.p = j
a.x = h
f.s = j
f.v = n
f.q = e
f.p = l
h.u = n
h.s = d
h.q = l
b.p = a
b.x = n
e.s = b
e.v = h
e.q = l
e.p = l
j.p = b
j.x = h
l.s = a
l.v = n
l.q = e
l.p = i
i.s = j
i.v = h
i.q = f
i.p = e
assert n.q.q.s.txt == "b"