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

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

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

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

c = A("c")
h = B("h")
a = C("a")
k = D("k")
g = D("g")
n = B("n")
l = B("l")
b = C("b")
m = A("m")
j = C("j")

c.v = k
c.q = n
c.u = m
h.s = m
h.q = m
a.p = c
a.y = m
k.w = l
k.s = g
k.u = c
k.r = n
g.w = l
g.s = k
g.u = m
g.r = h
n.s = c
n.q = m
l.s = m
l.q = m
b.p = m
b.y = c
m.v = k
m.q = h
m.u = c
j.p = m
j.y = m
assert a.p.q.q.v.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: B = None
        self.u: A = None
        self.txt = txt

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

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

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

c = A("c")
h = B("h")
a = C("a")
k = D("k")
g = D("g")
n = B("n")
l = B("l")
b = C("b")
m = A("m")
j = C("j")

c.v = k
c.q = n
c.u = m
h.s = m
h.q = m
a.p = c
a.y = m
k.w = l
k.s = g
k.u = c
k.r = n
g.w = l
g.s = k
g.u = m
g.r = h
n.s = c
n.q = m
l.s = m
l.q = m
b.p = m
b.y = c
m.v = k
m.q = h
m.u = c
j.p = m
j.y = m
assert a.p.q.q.v.u.u.txt == "m"