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

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

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

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

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

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

e.t = i
e.v = f
e.u = f
e.w = f
i.u = g
i.v = e
g.u = i
g.v = e
g.x = f
g.o = h
f.u = i
f.w = i
f.t = b
h.o = b
h.q = c
j.t = i
j.v = c
j.u = c
j.w = f
b.u = i
b.v = e
b.x = f
b.o = h
c.u = i
c.w = i
c.t = g
assert h.q.w.u.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: D = None
        self.u: D = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

e.t = i
e.v = f
e.u = f
e.w = f
i.u = g
i.v = e
g.u = i
g.v = e
g.x = f
g.o = h
f.u = i
f.w = i
f.t = b
h.o = b
h.q = c
j.t = i
j.v = c
j.u = c
j.w = f
b.u = i
b.v = e
b.x = f
b.o = h
c.u = i
c.w = i
c.t = g
assert h.q.w.u.o.o.o.txt == "h"