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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

g.w = a
g.r = a
b.p = g
c.t = n
c.x = h
k.z = n
n.u = a
h.t = n
h.x = i
a.p = g
i.t = j
i.x = h
j.u = b
assert b.p.r.p.r.p.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

g.w = a
g.r = a
b.p = g
c.t = n
c.x = h
k.z = n
n.u = a
h.t = n
h.x = i
a.p = g
i.t = j
i.x = h
j.u = b
assert b.p.r.p.r.p.r.p.txt == "g"