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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: D = None
        self.o: B = None
        self.txt = txt

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

n.w = h
n.r = j
n.q = j
n.u = m
l.t = c
l.u = n
j.r = n
k.y = l
k.u = h
k.o = b
c.t = l
c.u = n
m.y = b
m.u = h
m.o = l
h.y = c
h.u = k
h.o = l
b.t = l
b.u = n
assert n.r.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: C = None
        self.q: C = None
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: D = None
        self.o: B = None
        self.txt = txt

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

n.w = h
n.r = j
n.q = j
n.u = m
l.t = c
l.u = n
j.r = n
k.y = l
k.u = h
k.o = b
c.t = l
c.u = n
m.y = b
m.u = h
m.o = l
h.y = c
h.u = k
h.o = l
b.t = l
b.u = n
assert n.r.r.u.txt == "m"