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

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

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

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

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

h = A("h")
l = B("l")
a = C("a")
e = D("e")
j = E("j")
f = C("f")
n = C("n")
c = E("c")
g = D("g")
b = A("b")

h.w = l
h.o = g
h.y = b
l.o = b
a.o = l
a.r = l
a.z = e
e.q = c
e.x = a
j.o = g
j.y = f
j.q = l
f.o = l
f.r = l
f.z = g
n.o = l
n.r = l
n.z = g
c.o = e
c.y = f
c.q = l
g.q = c
g.x = a
b.w = l
b.o = e
b.y = h
assert j.o.x.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: D = None
        self.y: A = None
        self.txt = txt

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

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

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

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

h = A("h")
l = B("l")
a = C("a")
e = D("e")
j = E("j")
f = C("f")
n = C("n")
c = E("c")
g = D("g")
b = A("b")

h.w = l
h.o = g
h.y = b
l.o = b
a.o = l
a.r = l
a.z = e
e.q = c
e.x = a
j.o = g
j.y = f
j.q = l
f.o = l
f.r = l
f.z = g
n.o = l
n.r = l
n.z = g
c.o = e
c.y = f
c.q = l
g.q = c
g.x = a
b.w = l
b.o = e
b.y = h
assert j.o.x.r.o.txt == "b"