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

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

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

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

m = A("m")
d = B("d")
e = C("e")
i = D("i")
b = A("b")
g = D("g")
n = A("n")

m.v = g
m.t = g
m.o = d
d.s = i
d.o = e
d.t = n
d.p = m
e.r = i
e.z = d
i.u = e
i.z = b
b.v = i
b.t = i
b.o = d
g.u = e
g.z = b
n.v = i
n.t = i
n.o = d
assert e.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: D = None
        self.o: B = None
        self.txt = txt

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

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

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

m = A("m")
d = B("d")
e = C("e")
i = D("i")
b = A("b")
g = D("g")
n = A("n")

m.v = g
m.t = g
m.o = d
d.s = i
d.o = e
d.t = n
d.p = m
e.r = i
e.z = d
i.u = e
i.z = b
b.v = i
b.t = i
b.o = d
g.u = e
g.z = b
n.v = i
n.t = i
n.o = d
assert e.r.u.r.txt == "i"