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

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

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

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

i = A("i")
f = B("f")
e = C("e")
n = D("n")
l = C("l")
d = D("d")
g = B("g")
c = A("c")
j = C("j")
k = B("k")

i.w = d
i.o = l
f.r = i
e.s = l
e.t = f
e.v = g
e.x = j
n.v = d
n.o = d
n.r = c
n.y = f
l.s = j
l.t = g
l.v = f
l.x = e
d.v = n
d.o = n
d.r = i
d.y = f
g.r = c
c.w = n
c.o = l
j.s = e
j.x = e
j.t = f
j.v = k
k.r = i
assert g.r.w.r.o.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: C = None
        self.txt = txt

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

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

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

i = A("i")
f = B("f")
e = C("e")
n = D("n")
l = C("l")
d = D("d")
g = B("g")
c = A("c")
j = C("j")
k = B("k")

i.w = d
i.o = l
f.r = i
e.s = l
e.t = f
e.v = g
e.x = j
n.v = d
n.o = d
n.r = c
n.y = f
l.s = j
l.t = g
l.v = f
l.x = e
d.v = n
d.o = n
d.r = i
d.y = f
g.r = c
c.w = n
c.o = l
j.s = e
j.x = e
j.t = f
j.v = k
k.r = i
assert g.r.w.r.o.x.v.txt == "g"