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

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: A = None
        self.p: B = None
        self.v: A = None
        self.txt = txt

i = A("i")
n = B("n")
j = C("j")
g = D("g")
e = B("e")

i.s = n
i.r = g
i.y = e
i.v = j
n.y = j
n.r = j
j.s = g
j.r = g
j.v = e
g.w = e
g.p = e
g.u = i
g.v = i
e.y = j
e.r = j
assert n.y.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: D = None
        self.y: B = None
        self.v: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: A = None
        self.p: B = None
        self.v: A = None
        self.txt = txt

i = A("i")
n = B("n")
j = C("j")
g = D("g")
e = B("e")

i.s = n
i.r = g
i.y = e
i.v = j
n.y = j
n.r = j
j.s = g
j.r = g
j.v = e
g.w = e
g.p = e
g.u = i
g.v = i
e.y = j
e.r = j
assert n.y.v.y.txt == "j"