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

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

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

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

g = A("g")
a = B("a")
m = C("m")
n = D("n")
j = B("j")
k = D("k")
i = D("i")
e = C("e")
h = A("h")

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

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

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

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

g = A("g")
a = B("a")
m = C("m")
n = D("n")
j = B("j")
k = D("k")
i = D("i")
e = C("e")
h = A("h")

g.v = i
g.r = j
g.y = j
g.q = h
a.u = i
m.y = j
m.v = e
m.o = e
n.r = m
n.u = g
n.o = k
j.u = k
k.r = m
k.u = g
k.o = n
i.r = m
i.u = h
i.o = k
e.y = a
e.v = m
e.o = m
h.v = i
h.r = j
h.y = j
h.q = g
assert i.o.r.o.o.y.txt == "j"