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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: E = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
d = C("d")
k = D("k")
a = E("a")
m = D("m")
f = E("f")
n = E("n")
h = C("h")
b = D("b")

e.y = d
e.w = m
j.w = n
j.x = a
d.o = f
d.r = f
d.z = h
d.v = e
d.y = j
k.y = h
k.r = a
k.p = a
k.o = e
a.q = h
m.y = d
m.r = a
m.p = f
m.o = e
f.q = d
n.q = d
h.o = f
h.z = d
h.v = e
h.r = a
h.y = j
b.y = d
b.r = f
b.p = f
b.o = e
assert j.w.q.r.q.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: E = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
d = C("d")
k = D("k")
a = E("a")
m = D("m")
f = E("f")
n = E("n")
h = C("h")
b = D("b")

e.y = d
e.w = m
j.w = n
j.x = a
d.o = f
d.r = f
d.z = h
d.v = e
d.y = j
k.y = h
k.r = a
k.p = a
k.o = e
a.q = h
m.y = d
m.r = a
m.p = f
m.o = e
f.q = d
n.q = d
h.o = f
h.z = d
h.v = e
h.r = a
h.y = j
b.y = d
b.r = f
b.p = f
b.o = e
assert j.w.q.r.q.v.w.txt == "m"