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

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

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

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

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

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

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

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

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

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

i.v = h
i.t = h
a.r = f
a.s = l
b.r = n
b.v = i
h.v = m
h.u = i
h.o = g
h.t = l
n.r = b
n.v = i
g.r = n
g.v = i
f.v = h
f.t = h
m.r = i
m.s = g
l.r = g
l.v = f
assert b.r.v.v.v.s.r.txt == "n"