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

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

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

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

g = A("g")
f = B("f")
a = C("a")
l = D("l")
c = C("c")
d = B("d")
i = A("i")
h = D("h")

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

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

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

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

g = A("g")
f = B("f")
a = C("a")
l = D("l")
c = C("c")
d = B("d")
i = A("i")
h = D("h")

g.r = h
g.q = i
g.z = d
g.y = a
f.y = l
f.t = l
f.q = h
f.z = d
a.p = d
a.o = i
a.q = c
a.u = c
l.r = f
l.p = d
l.u = i
c.p = f
c.o = g
c.q = a
c.u = a
d.y = h
d.q = h
d.t = l
d.z = f
i.r = h
i.q = g
i.z = f
i.y = c
h.r = f
h.p = f
h.u = i
assert i.q.y.p.t.p.q.u.q.txt == "g"