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

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

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

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

b = A("b")
n = B("n")
l = C("l")
k = D("k")
c = D("c")
g = D("g")
m = B("m")
i = A("i")
d = C("d")

b.v = n
b.q = d
n.p = l
n.y = l
n.q = l
l.q = d
l.u = n
k.p = m
k.q = m
k.x = g
k.y = c
c.p = m
c.q = m
c.x = g
c.y = g
g.p = m
g.x = k
g.q = n
g.y = c
m.p = l
m.y = l
m.q = l
i.v = m
i.q = d
d.q = l
d.u = n
assert n.q.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: C = None
        self.txt = txt

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

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

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

b = A("b")
n = B("n")
l = C("l")
k = D("k")
c = D("c")
g = D("g")
m = B("m")
i = A("i")
d = C("d")

b.v = n
b.q = d
n.p = l
n.y = l
n.q = l
l.q = d
l.u = n
k.p = m
k.q = m
k.x = g
k.y = c
c.p = m
c.q = m
c.x = g
c.y = g
g.p = m
g.x = k
g.q = n
g.y = c
m.p = l
m.y = l
m.q = l
i.v = m
i.q = d
d.q = l
d.u = n
assert n.q.q.u.txt == "n"