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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: C = None
        self.p: A = None
        self.x: A = None
        self.txt = txt

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

h.r = f
h.u = f
h.w = e
b.o = g
b.r = e
b.y = h
k.z = n
k.o = n
k.t = e
e.o = g
e.y = n
l.u = e
l.t = n
l.p = f
l.x = h
n.z = k
n.o = k
n.t = e
f.r = h
f.u = h
f.w = e
g.o = b
g.r = e
g.y = h
assert g.o.o.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: D = None
        self.u: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: C = None
        self.p: A = None
        self.x: A = None
        self.txt = txt

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

h.r = f
h.u = f
h.w = e
b.o = g
b.r = e
b.y = h
k.z = n
k.o = n
k.t = e
e.o = g
e.y = n
l.u = e
l.t = n
l.p = f
l.x = h
n.z = k
n.o = k
n.t = e
f.r = h
f.u = h
f.w = e
g.o = b
g.r = e
g.y = h
assert g.o.o.r.y.txt == "n"