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

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

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

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

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

g.t = j
g.z = c
g.v = e
n.v = e
n.u = e
n.o = e
e.w = c
e.y = a
c.u = a
c.y = e
i.u = n
i.y = e
a.v = e
a.u = e
a.o = e
j.t = g
j.z = c
j.v = e
assert n.o.w.u.o.w.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: D = None
        self.v: C = None
        self.txt = txt

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

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

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

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

g.t = j
g.z = c
g.v = e
n.v = e
n.u = e
n.o = e
e.w = c
e.y = a
c.u = a
c.y = e
i.u = n
i.y = e
a.v = e
a.u = e
a.o = e
j.t = g
j.z = c
j.v = e
assert n.o.w.u.o.w.u.o.txt == "e"