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

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

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

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

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

n.v = g
n.t = g
g.r = l
g.t = n
g.w = a
h.s = a
h.q = g
h.t = n
h.y = i
a.o = i
a.r = b
b.v = l
b.t = l
i.s = a
i.q = g
i.t = n
i.y = m
m.s = a
m.q = l
m.t = n
m.y = h
l.r = g
l.t = n
l.w = a
assert b.t.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: B = None
        self.txt = txt

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

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

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

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

n.v = g
n.t = g
g.r = l
g.t = n
g.w = a
h.s = a
h.q = g
h.t = n
h.y = i
a.o = i
a.r = b
b.v = l
b.t = l
i.s = a
i.q = g
i.t = n
i.y = m
m.s = a
m.q = l
m.t = n
m.y = h
l.r = g
l.t = n
l.w = a
assert b.t.r.w.txt == "a"