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

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

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

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

i = A("i")
j = B("j")
b = C("b")
e = D("e")
a = A("a")
f = D("f")
l = B("l")
n = B("n")
g = C("g")
k = D("k")

i.r = l
i.q = k
j.v = n
j.z = l
j.q = b
b.t = g
b.q = g
b.r = f
b.y = a
e.u = g
e.w = f
e.t = k
e.v = n
a.r = l
a.q = f
f.u = g
f.w = e
f.t = k
f.v = j
l.v = n
l.z = j
l.q = b
n.v = j
n.z = l
n.q = g
g.t = b
g.q = b
g.r = k
g.y = i
k.u = b
k.w = f
k.t = e
k.v = l
assert f.v.z.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: D = None
        self.txt = txt

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

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

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

i = A("i")
j = B("j")
b = C("b")
e = D("e")
a = A("a")
f = D("f")
l = B("l")
n = B("n")
g = C("g")
k = D("k")

i.r = l
i.q = k
j.v = n
j.z = l
j.q = b
b.t = g
b.q = g
b.r = f
b.y = a
e.u = g
e.w = f
e.t = k
e.v = n
a.r = l
a.q = f
f.u = g
f.w = e
f.t = k
f.v = j
l.v = n
l.z = j
l.q = b
n.v = j
n.z = l
n.q = g
g.t = b
g.q = b
g.r = k
g.y = i
k.u = b
k.w = f
k.t = e
k.v = l
assert f.v.z.q.t.txt == "g"