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

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

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

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

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

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

d.o = i
d.q = g
d.x = f
d.w = f
i.r = g
i.p = b
h.x = i
h.u = a
h.w = g
h.v = g
a.u = d
g.z = e
f.r = g
f.p = a
j.o = i
j.q = g
j.x = f
j.w = f
e.x = i
e.u = b
e.w = g
e.v = g
b.u = d
assert f.p.u.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: E = None
        self.x: B = None
        self.w: B = None
        self.txt = txt

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

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

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

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

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

d.o = i
d.q = g
d.x = f
d.w = f
i.r = g
i.p = b
h.x = i
h.u = a
h.w = g
h.v = g
a.u = d
g.z = e
f.r = g
f.p = a
j.o = i
j.q = g
j.x = f
j.w = f
e.x = i
e.u = b
e.w = g
e.v = g
b.u = d
assert f.p.u.o.p.txt == "b"