class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: A = None
        self.y: B = None
        self.u: E = None
        self.t: E = None
        self.txt = txt

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

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

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

j = A("j")
f = B("f")
l = C("l")
i = D("i")
h = E("h")
c = B("c")

j.r = h
f.p = j
f.w = j
f.y = c
f.u = h
f.t = h
l.t = h
l.p = h
i.o = h
i.q = f
h.o = c
h.x = c
h.w = f
h.p = l
c.p = j
c.w = j
c.y = f
c.u = h
c.t = h
assert h.w.y.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: A = None
        self.y: B = None
        self.u: E = None
        self.t: E = None
        self.txt = txt

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

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

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

j = A("j")
f = B("f")
l = C("l")
i = D("i")
h = E("h")
c = B("c")

j.r = h
f.p = j
f.w = j
f.y = c
f.u = h
f.t = h
l.t = h
l.p = h
i.o = h
i.q = f
h.o = c
h.x = c
h.w = f
h.p = l
c.p = j
c.w = j
c.y = f
c.u = h
c.t = h
assert h.w.y.w.r.txt == "h"