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

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: C = None
        self.w: A = None
        self.x: A = None
        self.txt = txt

d = A("d")
e = B("e")
i = C("i")
j = D("j")
f = A("f")
m = B("m")
a = C("a")

d.r = j
e.o = j
e.v = j
e.r = d
i.y = f
i.u = j
i.v = d
j.s = a
j.v = i
j.w = f
j.x = f
f.r = j
m.o = j
m.v = j
m.r = d
a.y = f
a.v = f
a.u = j
assert m.v.x.r.x.r.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: C = None
        self.w: A = None
        self.x: A = None
        self.txt = txt

d = A("d")
e = B("e")
i = C("i")
j = D("j")
f = A("f")
m = B("m")
a = C("a")

d.r = j
e.o = j
e.v = j
e.r = d
i.y = f
i.u = j
i.v = d
j.s = a
j.v = i
j.w = f
j.x = f
f.r = j
m.o = j
m.v = j
m.r = d
a.y = f
a.v = f
a.u = j
assert m.v.x.r.x.r.s.v.txt == "f"