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

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

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

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

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

h.z = i
h.u = d
h.r = f
j.r = f
j.q = f
j.z = d
j.o = i
d.y = l
f.y = j
c.y = g
l.z = b
l.u = d
l.r = f
b.r = f
b.q = f
b.z = c
b.o = j
n.y = h
g.z = b
g.u = n
g.r = f
i.r = f
i.q = f
i.z = d
i.o = j
assert i.o.o.z.y.z.o.o.q.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: C = None
        self.r: D = None
        self.txt = txt

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

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

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

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

h.z = i
h.u = d
h.r = f
j.r = f
j.q = f
j.z = d
j.o = i
d.y = l
f.y = j
c.y = g
l.z = b
l.u = d
l.r = f
b.r = f
b.q = f
b.z = c
b.o = j
n.y = h
g.z = b
g.u = n
g.r = f
i.r = f
i.q = f
i.z = d
i.o = j
assert i.o.o.z.y.z.o.o.q.y.o.txt == "i"