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

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

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

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

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

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

e.q = h
e.r = h
e.x = j
h.q = j
h.t = i
n.u = d
n.v = i
j.o = b
i.t = k
i.u = h
i.w = e
i.q = e
i.x = b
d.o = b
m.u = b
m.v = i
k.u = j
k.v = i
b.o = d
assert h.t.q.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: D = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

e.q = h
e.r = h
e.x = j
h.q = j
h.t = i
n.u = d
n.v = i
j.o = b
i.t = k
i.u = h
i.w = e
i.q = e
i.x = b
d.o = b
m.u = b
m.v = i
k.u = j
k.v = i
b.o = d
assert h.t.q.q.t.txt == "i"