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

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

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

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

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

g = A("g")
j = B("j")
l = C("l")
i = D("i")
m = E("m")
b = C("b")
f = B("f")

g.y = b
j.s = i
j.t = b
j.y = l
l.z = b
l.q = b
l.v = f
l.s = m
i.t = g
i.o = j
m.v = j
m.o = g
b.z = l
b.q = l
b.v = j
b.s = m
f.s = i
f.t = b
f.y = b
assert f.y.q.s.o.y.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

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

g = A("g")
j = B("j")
l = C("l")
i = D("i")
m = E("m")
b = C("b")
f = B("f")

g.y = b
j.s = i
j.t = b
j.y = l
l.z = b
l.q = b
l.v = f
l.s = m
i.t = g
i.o = j
m.v = j
m.o = g
b.z = l
b.q = l
b.v = j
b.s = m
f.s = i
f.t = b
f.y = b
assert f.y.q.s.o.y.q.v.txt == "f"