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

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

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

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

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

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

i.p = h
e.t = g
e.q = c
e.s = a
e.x = a
c.s = j
c.t = i
c.u = a
a.x = c
g.w = i
g.x = i
j.p = h
h.w = j
h.x = j
b.t = h
b.q = c
b.s = a
b.x = a
assert b.x.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

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

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

i.p = h
e.t = g
e.q = c
e.s = a
e.x = a
c.s = j
c.t = i
c.u = a
a.x = c
g.w = i
g.x = i
j.p = h
h.w = j
h.x = j
b.t = h
b.q = c
b.s = a
b.x = a
assert b.x.x.s.txt == "j"