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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: D = None
        self.t: D = None
        self.w: A = None
        self.z: E = None
        self.txt = txt

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

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

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

i = A("i")
h = B("h")
f = C("f")
b = D("b")
n = E("n")
a = A("a")
k = C("k")
l = B("l")

i.r = a
i.y = f
h.v = a
h.x = b
h.t = b
h.w = i
h.z = n
f.q = n
f.t = b
b.r = k
n.y = f
n.z = l
a.r = i
a.y = f
k.q = n
k.t = b
l.v = a
l.x = b
l.t = b
l.w = i
l.z = n
assert l.z.z.v.y.q.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: D = None
        self.t: D = None
        self.w: A = None
        self.z: E = None
        self.txt = txt

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

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

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

i = A("i")
h = B("h")
f = C("f")
b = D("b")
n = E("n")
a = A("a")
k = C("k")
l = B("l")

i.r = a
i.y = f
h.v = a
h.x = b
h.t = b
h.w = i
h.z = n
f.q = n
f.t = b
b.r = k
n.y = f
n.z = l
a.r = i
a.y = f
k.q = n
k.t = b
l.v = a
l.x = b
l.t = b
l.w = i
l.z = n
assert l.z.z.v.y.q.y.t.txt == "b"