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

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

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

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

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

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

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

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

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

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

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

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

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