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

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

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

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

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

j.y = m
j.o = m
j.w = f
j.t = f
l.p = j
l.q = m
l.t = i
l.y = g
m.o = j
m.z = d
m.q = d
m.r = g
f.z = d
f.w = m
b.p = g
b.y = g
b.q = d
b.t = l
i.p = g
i.y = g
i.q = m
i.t = e
d.o = g
d.z = m
d.q = m
d.r = j
e.p = j
e.q = d
e.t = l
e.y = g
n.z = d
n.w = d
g.y = d
g.o = d
g.w = n
g.t = n
assert i.t.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: D = None
        self.t: D = None
        self.o: C = None
        self.txt = txt

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

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

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

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

j.y = m
j.o = m
j.w = f
j.t = f
l.p = j
l.q = m
l.t = i
l.y = g
m.o = j
m.z = d
m.q = d
m.r = g
f.z = d
f.w = m
b.p = g
b.y = g
b.q = d
b.t = l
i.p = g
i.y = g
i.q = m
i.t = e
d.o = g
d.z = m
d.q = m
d.r = j
e.p = j
e.q = d
e.t = l
e.y = g
n.z = d
n.w = d
g.y = d
g.o = d
g.w = n
g.t = n
assert i.t.p.o.txt == "m"