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

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

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

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

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

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

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

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

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

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

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